結果
| 問題 |
No.548 国士無双
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-15 10:43:03 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 900 bytes |
| コンパイル時間 | 1,520 ms |
| コンパイル使用メモリ | 168,944 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-17 13:49:39 |
| 合計ジャッジ時間 | 2,365 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:40:29: warning: 'empty' may be used uninitialized [-Wmaybe-uninitialized]
40 | cout << (char) ('a' + empty) << endl;
| ~~~~~^~~~~~~~
main.cpp:19:39: note: 'empty' was declared here
19 | int cnt0 = 0, cnt1 = 0, cnt2 = 0, empty;
| ^~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
vector<int> a(13);
REP(i, 13) {
char c;
cin >> c;
a[c - 'a']++;
}
int cnt0 = 0, cnt1 = 0, cnt2 = 0, empty;
REP(i, 13) {
switch (a[i]) {
case 0:
cnt0++;
empty = i;
break;
case 1:
cnt1++;
break;
case 2:
cnt2++;
break;
default:
break;
}
}
if (cnt1 == 13) {
REP(i, 13) cout << (char) ('a' + i) << endl;
} else if (cnt0 == 1 && cnt1 == 11 && cnt2 == 1) {
cout << (char) ('a' + empty) << endl;
} else {
cout << "Impossible" << endl;
}
return 0;
}