結果
| 問題 |
No.548 国士無双
|
| ユーザー |
dsytk7
|
| 提出日時 | 2017-07-28 22:28:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,062 bytes |
| コンパイル時間 | 1,032 ms |
| コンパイル使用メモリ | 159,652 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 12:57:22 |
| 合計ジャッジ時間 | 1,679 ms |
|
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i))
using ll = long long;
using P = pair< int, int >;
string t = "abcdfgjhijklm";
int a[14];
int main() {
string s;
cin >> s;
rep(i, s.size()) {
a[s[i]-'a']++;
}
bool two=false;
bool zero=false;
bool ok=true;
rep(i, 13) {
if (a[i] == 2) {
if (!two) { two = true; }
else { ok = false; break; }
}
else if (a[i] == 0) {
if (!zero) { zero = true; }
else { ok = false; break; }
}
else if (a[i] > 2) {
ok = false;
break;
}
}
if (!ok) { cout << "Impossible" << endl; }
else {
if (zero) {
rep(i, 13) {
if (a[i] == 0) {
cout << char('a' + i) << endl;
return 0;
}
}
}
else {
rep(i, 13) {
cout << char('a'+i) << endl;
}
}
}
}
dsytk7