結果

問題 No.2715 Unique Chimatagram
ユーザー GOTKAKO
提出日時 2024-04-05 21:32:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 629 bytes
コンパイル時間 2,246 ms
コンパイル使用メモリ 205,528 KB
最終ジャッジ日時 2025-02-20 20:55:28
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 4 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int N; cin >> N;
    map<string,int> S;
    for(int i=0; i<N; i++){
        string s; cin >> s;
        sort(s.begin(),s.end());
        S[s]++;
    }

    map<string,int> S2;
    for(auto [k,v] : S){
        if(v != 1) continue;
        for(char c='a'; c<='z'; c++){
            string s; cin >> s;
            s += c;
            sort(s.begin(),s.end());
            S2[s]++;
        }
    }
    for(auto [k,v] : S2){
        if(v == 1){cout << k << endl; return 0;}
    }
    cout << -1 << endl;
}
0