結果
問題 |
No.233 めぐるはめぐる (3)
|
ユーザー |
![]() |
提出日時 | 2016-04-07 20:02:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 238 ms / 1,000 ms |
コード長 | 837 bytes |
コンパイル時間 | 960 ms |
コンパイル使用メモリ | 84,788 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2024-10-10 23:54:10 |
合計ジャッジ時間 | 5,667 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
#include <iostream> #include <algorithm> #include <set> using namespace std; int main(){ set<string> s; int n; cin >> n; for(int i = 0;i < n;i++){ string str; cin >> str; s.insert(str); } string a = "iaaeuu",b = "nbmgr"; stable_sort(a.begin(),a.end()); stable_sort(b.begin(),b.end()); do{ do{ string tmp = " "; for(int i = 0;i < 5;i++){ tmp[i * 2] = b[i]; tmp[i * 2 + 1] = a[i]; } for(int i = 0;i < 11;i++){ string str = tmp.substr(0,i) + a[5] + tmp.substr(i); if(!s.count(str)){ cout << str << endl; return 0; } } }while(next_permutation(b.begin(),b.end())); }while(next_permutation(a.begin(),a.end())); cout << "NO" << endl; }