結果
問題 |
No.233 めぐるはめぐる (3)
|
ユーザー |
![]() |
提出日時 | 2015-07-04 00:54:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,221 bytes |
コンパイル時間 | 1,559 ms |
コンパイル使用メモリ | 164,576 KB |
実行使用メモリ | 12,800 KB |
最終ジャッジ日時 | 2024-07-07 22:48:17 |
合計ジャッジ時間 | 5,124 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | RE * 4 TLE * 1 -- * 6 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’: main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%s", tmp); | ~~~~~^~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; char v[] = {'a', 'i', 'u', 'e', 'o'}; int main(int argc, char *argv[]){ int n; cin >> n; string used[n]; for (int i = 0; i < n; i++) { char tmp[7]; scanf("%s", tmp); used[i] = tmp; } string vowel = "iaaeuu"; string consonant = "nbmgr"; sort(vowel.begin(), vowel.end()); sort(consonant.begin(), consonant.end()); bool ok; string ans; do{ do{ ok = true; for (int i = 0; i < 6; i++) { ans = ""; int seq = 0; for (int j = 0; j < 5; j++) { if(i == j){ ans += vowel.substr(j, 1); seq++; } ans += consonant.substr(j, 1) + vowel.substr(j + seq, 1); } if(seq == 0)ans += vowel.substr(5, 1); //std::cout << ans << std::endl; for (int j = 0; j < n; j++) { if(used[j] != ans)continue; ok = false; break; } if(ok)break; } if(ok)break; }while(next_permutation(consonant.begin(), consonant.end())); if(ok)break; }while(next_permutation(vowel.begin(), vowel.end())); if(ok)std::cout << ans << std::endl; else std::cout << "NO" << std::endl; return 0; }