結果
問題 | No.2715 Unique Chimatagram |
ユーザー |
![]() |
提出日時 | 2024-11-04 12:00:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,209 bytes |
コンパイル時間 | 4,717 ms |
コンパイル使用メモリ | 260,228 KB |
最終ジャッジ日時 | 2025-02-25 02:13:44 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 4 WA * 36 |
ソースコード
#include <bits/stdc++.h> #include<atcoder/all> using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ll mod=998244353; ll inf=1000000000000000000; int main(){ ll n; cin >> n; vector<string>s(n); for (ll i = 0; i < n; i++) { cin >> s[i]; sort(s[i].begin(),s[i].end()); } for (ll i = 0; i < n; i++) { map<char,ll>memo,memo2; for (ll j = 0; j < s[i].size(); j++) { memo2[s[i][j]]++; } bool ok=true; for (ll j = 0; j < n; j++) { if (j==i) { continue; } memo=memo2; bool o=true; for (ll k = 0; k < s[j].size(); k++) { if (memo[s[j][k]]==0) { o=false; break; }else{ memo[s[j][k]]--; } } if (o) { ok=false; break; } } if (ok) { cout << s[i] << endl; return 0; } } cout << -1 << endl; }