結果
| 問題 |
No.548 国士無双
|
| ユーザー |
Yut176
|
| 提出日時 | 2017-10-09 17:07:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 676 bytes |
| コンパイル時間 | 712 ms |
| コンパイル使用メモリ | 84,188 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 13:47:11 |
| 合計ジャッジ時間 | 1,550 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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++){
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
Yut176