結果
問題 |
No.233 めぐるはめぐる (3)
|
ユーザー |
![]() |
提出日時 | 2015-07-04 00:05:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 886 bytes |
コンパイル時間 | 1,209 ms |
コンパイル使用メモリ | 169,440 KB |
実行使用メモリ | 18,016 KB |
最終ジャッジ日時 | 2024-07-07 22:44:30 |
合計ジャッジ時間 | 4,741 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | AC * 4 TLE * 1 -- * 6 |
ソースコード
#include<bits/stdc++.h> using namespace std; char v[] = {'a', 'i', 'u', 'e', 'o'}; bool vowel(char c){ for (int i = 0; i < 5; i++) { if(v[i] == c)return true; } return false; } int main(int argc, char *argv[]){ unordered_set<string> used; int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; used.insert(s); } string s = "inabameguru"; sort(s.begin(), s.end()); bool flag; do{ bool ok = true; for (int i = 1; i < s.length(); i++) { if(!vowel(s[i - 1]) && !vowel(s[i])){ ok = false; break; } } if(!ok || !vowel(s.back()))continue; flag = true; for (string ss:used){ if(s != ss)continue; flag = false; } if(flag)break; }while(next_permutation(s.begin(), s.end())); if(flag)std::cout << s << std::endl; else std::cout << "NO" << std::endl; return 0; }