結果

問題 No.2737 Compound Word
コンテスト
ユーザー cho435
提出日時 2024-04-16 02:12:08
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 689 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,627 ms
コンパイル使用メモリ 337,088 KB
実行使用メモリ 11,964 KB
最終ジャッジ日時 2026-07-04 12:07:54
合計ジャッジ時間 6,712 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 26 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const ll MIN_N = 2;
const ll MAX_N = 50;
const ll MIN_Ssize = 1;
const ll MAX_Ssize = 100;
const ll MAX_Ssum = 300;

int main() {
    registerValidation();
    ll N = inf.readLong(MIN_N, MAX_N);
    inf.readEoln();
    ll Ssum = 0;
    set<string> st;
    for(int i=0;i<N;i++){
        string S = inf.readToken("[a-z]{1,100}");
        inf.readEoln();
        Ssum += S.size();
        st.insert(S);
    }
    assert(Ssum <= MAX_Ssum);
    assert((int)st.size() == N);
    set<string> ans;
    for(auto s:st) for(auto t:st) ans.insert(s+t);
    cout << (ans.size() - N) << endl;
    inf.readEof();
}
0