結果
問題 | No.233 めぐるはめぐる (3) |
ユーザー |
![]() |
提出日時 | 2015-06-28 17:23:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 124 ms / 1,000 ms |
コード長 | 816 bytes |
コンパイル時間 | 1,477 ms |
コンパイル使用メモリ | 169,172 KB |
実行使用メモリ | 13,696 KB |
最終ジャッジ日時 | 2024-07-07 20:37:23 |
合計ジャッジ時間 | 3,979 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%s",str); | ~~~~~^~~~~~~~~~
ソースコード
#include<bits/stdc++.h>using namespace std;int N;set<string>S;char s[]="nbmgr";char b[]="iaaeuu";int main(){scanf("%d",&N);for(int i=0;i<N;i++){char str[20];scanf("%s",str);S.insert(str);}sort(s,s+5);sort(b,b+6);do{do{for(int i=0;i<6;i++){string str;for(int j=0;j<5;j++){if(i==j)str+=b[5];str+=s[j];str+=b[j];}if(i==5)str+=b[5];if(S.find(str)==S.end()){printf("%s\n",str.c_str());return 0;}}}while(next_permutation(b,b+6));}while(next_permutation(s,s+5));puts("NO");return 0;}