結果

問題 No.2715 Unique Chimatagram
ユーザー futamegawafutamegawa
提出日時 2024-04-05 22:12:33
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 998 bytes
コンパイル時間 3,386 ms
コンパイル使用メモリ 259,176 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-05 22:12:48
合計ジャッジ時間 14,439 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 59 ms
6,676 KB
testcase_09 AC 68 ms
6,676 KB
testcase_10 AC 65 ms
6,676 KB
testcase_11 AC 69 ms
6,676 KB
testcase_12 AC 61 ms
6,676 KB
testcase_13 AC 66 ms
6,676 KB
testcase_14 AC 59 ms
6,676 KB
testcase_15 AC 64 ms
6,676 KB
testcase_16 AC 57 ms
6,676 KB
testcase_17 AC 64 ms
6,676 KB
testcase_18 AC 733 ms
6,676 KB
testcase_19 AC 706 ms
6,676 KB
testcase_20 AC 723 ms
6,676 KB
testcase_21 AC 702 ms
6,676 KB
testcase_22 AC 730 ms
6,676 KB
testcase_23 AC 729 ms
6,676 KB
testcase_24 AC 704 ms
6,676 KB
testcase_25 AC 728 ms
6,676 KB
testcase_26 AC 715 ms
6,676 KB
testcase_27 AC 725 ms
6,676 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 2 ms
6,676 KB
testcase_34 AC 2 ms
6,676 KB
testcase_35 AC 2 ms
6,676 KB
testcase_36 AC 2 ms
6,676 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 126 ms
6,676 KB
testcase_40 WA -
testcase_41 AC 54 ms
6,676 KB
testcase_42 AC 170 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using llu = long long unsigned;

// メイン関数
int main() {
    int n;
    cin >> n;

    vector<string> s(n);
    vector<map<char, int>> data(n);
    for (int i=0; i<n; ++i) {
        cin >> s[i];
        for (int j=0; j<s[i].size(); ++j) {
            data[i][s[i][j]]++;
        }
    }

    vector<bool> isNg(n);
    for (int i=0; i<n; ++i) {
        for (int j=i+1; j<n; ++j) {
            if (s[i].size() == s[j].size()) {
                int count = 0;
                for (char c='a'; c<='z'; ++c) {
                    if (data[i][c] != data[j][c]) { count++; }
                }
                if (count <= 2) {
                    isNg[i] = true;
                    isNg[j] = true;
                }
            }
        }
    }

    string ret = "-1";
    for (int i=0; i<n; ++i) {
        if (!isNg[i]) {
            ret = s[i] + 'a';
            break;
        }
    }

    cout << ret << endl; return 0;
}
0