結果
問題 |
No.548 国士無双
|
ユーザー |
![]() |
提出日時 | 2017-10-09 17:08:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 770 bytes |
コンパイル時間 | 709 ms |
コンパイル使用メモリ | 83,924 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-17 13:47:13 |
合計ジャッジ時間 | 1,545 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include<iostream> #include<map> #include<string> #include<vector> #include<algorithm> #include<numeric> #include<cmath> #include<queue> using namespace std; long long int inf = 10000000000; int main(){ string s; cin >> s; vector<int> c(13, 0); for(int i=0; i<s.size(); i++){ if( s[i] < 'a' || s[i] > 'z' ){ cout << "Impossible" << endl; return 0; } c[ s[i]-'a' ]++; } bool w = false; for(int i=0; i<13; i++){ bool t = false; int f = 0; c[i]++; for(int j=0; j<13; j++){ if( c[j] == 2 ) t = true; else if( c[j] == 1 ) f++; } c[i]--; char q = 'a' + i; if( t && f == 12 ){ cout << q << endl; w = true; } } if(!w) cout << "Impossible" << endl; return 0; } // EOF