結果

問題 No.2737 Compound Word
ユーザー winguwingu
提出日時 2024-04-20 11:31:47
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 2,636 bytes
コンパイル時間 4,188 ms
コンパイル使用メモリ 283,404 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 11:31:52
合計ジャッジ時間 5,156 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma region template
#include<bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
template<class T>inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define rep1(i,a) for(int i=0;i<(int)(a);i++)
#define rep2(i,a,b) for(int i =(int)(a);i<(int)(b);i++)
#define rep3(i,a,b,c) for(int i=(int)(a);i<(int)(b);i+=(int)(c))
#define overloadRep(a,b,c,d,e,...)e
#define rep(...) overloadRep(__VA_ARGS__,rep3,rep2,rep1)(__VA_ARGS__)
#define rrep(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define drep(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define spa " "
#define yes "Yes"
#define no "No"
#define int long long
const int inf=8e18;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
using P=pair<int,int>;
using T=tuple<int,int,int>;
bool bit(int &x,int &p){return (x>>p)&1;}

#pragma endregion

#define sit typename set<T>::iterator
template<class T>class Set{
   public:
    set<T>st;
    sit it;

    Set(const vector<T>& vec={}){
        for(const auto& val:vec)insert(val);
    }

    bool empty() const {return st.empty();}
    bool find(const T& x){it=st.find(x);return it!=st.end();}
    void clear(){st.clear();}
    void erase(const T& x){st.erase(st.find(x));}
    void erase(const sit& itx){st.erase(itx);}
    void insert(const T& x){st.insert(x);}
    int count(const T& x) const {return (int)st.count(x);}
    int size() const {return (int)st.size();}
    T front() const {return *st.begin();}
    T back() const {return *(--st.end());}
    sit begin() const {return st.begin();}
    sit end() const {return st.end();}
    sit rbegin() const {return st.rbegin();}
    sit rend() const {return st.rend();}
    sit lower_bound(const T& x) const {return st.lower_bound(x);}
    sit upper_bound(const T& x) const {return st.upper_bound(x);}

    void debug(){
        int cnt=0;
        cerr<<"\033[32mSet -> \033[m";
        cerr<<'{';
        if(size()!=1){
            for(const auto& s:st){
                cerr<<s<<", ";
                cnt++;
                if(cnt==size()-1 or cnt>=100)break;
            }
        }
        cerr<<back()<<'}'<<endl;
    }
};

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(15);

    int n;cin>>n;
    vector<string>s(n);rep(I,n)cin>>s[I];

    Set<string>st;

    rep(i,n)rep(j,n){
        if(i==j)continue;
        st.insert(s[i]+s[j]);
    }

    cout<<st.size()<<endl;

    return 0;
}
0