結果
| 問題 | No.548 国士無双 |
| コンテスト | |
| ユーザー |
hiyokko2
|
| 提出日時 | 2017-07-28 22:44:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 985 bytes |
| コンパイル時間 | 1,310 ms |
| コンパイル使用メモリ | 159,204 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-17 13:29:15 |
| 合計ジャッジ時間 | 2,098 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
typedef vector<vector<ll>> mat;
const int INF = 1e9;
bool check(string str)
{
bool two = false;
for (char c='a'; c<='m'; c++) {
int cnt = 0;
REP(i,str.length()) if (c == str[i]) cnt++;
if (cnt == 0) return false;
else if (cnt == 1) continue;
else if (cnt == 2) {
if (two) return false;
two = true;
} else {
return false;
}
}
if (!two) return false;
return true;
}
signed main()
{
string S;
cin >> S;
bool find = false;
for (char c='a'; c<='z'; c++) {
//cout << "### " << c << " ###" << endl;
if (check(S + c)) {
cout << c << endl;
find = true;
}
}
if (!find) {
cout << "Impossible" << endl;
}
}
hiyokko2