結果

問題 No.2715 Unique Chimatagram
ユーザー srjywrdnprkt
提出日時 2024-04-08 16:09:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 203,664 KB
最終ジャッジ日時 2025-02-20 23:07:41
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int N;
    string S;
    cin >> N;
    map<vector<int>, int> mp;
    for (int i=0; i<N; i++){
        cin >> S;
        vector<int> v(26);
        for (auto x : S) v[x-'a']++;
        for (int j=0; j<26; j++){
            v[j]++;
            mp[v]++;
            v[j]--;
        }
    }

    for (auto &[x, y] : mp){
        if (y == 1){
            for (int j=0; j<26; j++) cout << string(x[j], 'a'+j);
            cout << endl;
            return 0;
        }
    }

    cout << -1 << endl;

    return 0;
}
0