結果

問題 No.2715 Unique Chimatagram
ユーザー mint
提出日時 2024-04-06 00:29:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 2,281 ms
コンパイル使用メモリ 205,344 KB
最終ジャッジ日時 2025-02-20 22:16:57
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    map<string, int> m;
    string abc = "abcdefghijklmnopqrstuvwxyz";
    while(n--){
        string s; cin >> s;
        sort(s.begin(), s.end());
        m[s]++;
        for(int i = 0; i < 26; i++){
            string ss = s + abc[i];
            sort(ss.begin(), ss.end());
            m[ss]++;
        }
    }
    for(auto e : m){
        if(e.second == 1){
            cout << e.first << '\n';
            return 0;
        }
    }
    cout << -1 << '\n';
    return 0;
}
0