結果
問題 | No.233 めぐるはめぐる (3) |
ユーザー |
![]() |
提出日時 | 2016-12-02 01:18:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 176 ms / 1,000 ms |
コード長 | 1,161 bytes |
コンパイル時間 | 761 ms |
コンパイル使用メモリ | 92,544 KB |
実行使用メモリ | 13,568 KB |
最終ジャッジ日時 | 2024-11-27 16:55:50 |
合計ジャッジ時間 | 3,933 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#include <algorithm> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define rep(i, n) for (int i = 0; i < (n); i++) #define rrep(i, n) for (int i = (n)-1; i >= 0; i--) using namespace std; typedef long long int lli; typedef pair<lli, lli> P; lli MOD = 1000000007; int main() { char mt[6] = {'i', 'a', 'a', 'e', 'u', 'u'}; char pa[5] = {'m', 'g', 'r', 'n', 'b'}; sort(mt, mt + 6); sort(pa, pa + 5); set<string> s; int n; cin >> n; string t; rep(i, n) { cin >> t; s.insert(t); } do { do { string tmp = ".........."; rep(i, 5) tmp[2 * i + 1] = mt[i]; rep(i, 5) tmp[2 * i] = pa[i]; rep(i, 10) { string a = tmp; string b{mt[5]}; a.insert(i, b); if (s.find(a) == s.end()) { cout << a << endl; return 0; } } } while (next_permutation(pa, pa + 5)); } while (next_permutation(mt, mt + 6)); cout << "NO" << endl; }