結果
| 問題 | No.2715 Unique Chimatagram | 
| コンテスト | |
| ユーザー |  kokosei | 
| 提出日時 | 2024-04-05 21:28:03 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 12 ms / 2,000 ms | 
| コード長 | 579 bytes | 
| コンパイル時間 | 1,332 ms | 
| コンパイル使用メモリ | 111,168 KB | 
| 実行使用メモリ | 5,632 KB | 
| 最終ジャッジ日時 | 2024-10-01 01:40:25 | 
| 合計ジャッジ時間 | 3,194 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 40 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long;
int N;
map<string, int> cnt;
int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> N;
    for(int i = 0;i < N;i++){
        string s; cin >> s;
        for(char c = 'a';c <= 'z';c++){
            string t = s + c;
            sort(t.begin(), t.end());
            cnt[t]++;
        }
    }
    for(auto [s, p] : cnt){
        if(p == 1){
            cout << s << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}
            
            
            
        