結果
問題 |
No.2715 Unique Chimatagram
|
ユーザー |
![]() |
提出日時 | 2024-04-05 22:58:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 1,978 ms |
コンパイル使用メモリ | 178,836 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-10-01 02:58:00 |
合計ジャッジ時間 | 4,236 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 WA * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; string S[1010],G[1010]; map<string,int>mp; int main(){ int t; string v; cin>>t; for(int i=0;i<t;i++){ cin>>S[i]; G[i]=S[i]; sort(G[i].begin(),G[i].end()); mp[G[i]]++; } for(int i=0;i<t;i++){ if(mp[G[i]]>1) continue; for(int j=0;j<26;j++){ char ch=j+'a'; string w=G[i]; w.push_back(ch); sort(w.begin(),w.end()); if(mp[w]==0){ S[i].push_back(ch); cout<<S[i]; return 0; } } } cout<<-1; }