結果
問題 |
No.2715 Unique Chimatagram
|
ユーザー |
|
提出日時 | 2024-04-05 21:28:03 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,070 bytes |
コンパイル時間 | 4,508 ms |
コンパイル使用メモリ | 255,604 KB |
最終ジャッジ日時 | 2025-02-20 20:49:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 TLE * 1 -- * 14 |
ソースコード
#include <bits/stdc++.h> #include <type_traits> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; int n; vector<string> S; void solve(){ for(int i = 0;i<n;i++){ for(int j = 0;j<26;j++){ string t = S[i]; t.push_back('a'+j); sort(t.begin(), t.end()); bool is = true; for(int k = 0;k<n;k++){ if(k==i) continue; for(int l = 0;l<26;l++){ string u = S[k]; u.push_back('a'+l); sort(u.begin(), u.end()); if(t == u){ is = false; break; } } } if(is){ cout << t << endl; return; } } } cout<<-1<<endl; } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n; S = vector<string>(n); for(auto &i: S) cin >> i; solve(); }