結果
問題 | No.548 国士無双 |
ユーザー |
![]() |
提出日時 | 2017-08-20 12:15:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 1,635 ms |
コンパイル使用メモリ | 173,328 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-17 13:43:58 |
合計ジャッジ時間 | 2,209 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool solve(string x) { vector<int> c(13); for(int i = 0; i < x.size(); i++) { if(x[i] >= 'n') return false; c[x[i] - 97]++; } sort(c.begin(), c.end()); return c[0] == 1 && c[11] == 1; } string s; int main() { cin >> s; bool flag = false; for(char c = 'a'; c <= 'm'; c++) { string t = s + c; if(solve(t)) flag = true, cout << c << endl; } if(!flag) cout << "Impossible" << endl; return 0; }