結果

問題 No.233 めぐるはめぐる (3)
ユーザー latte0119latte0119
提出日時 2015-06-28 17:23:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 127 ms / 1,000 ms
コード長 816 bytes
コンパイル時間 1,655 ms
コンパイル使用メモリ 154,636 KB
実行使用メモリ 13,620 KB
最終ジャッジ日時 2023-09-22 03:52:00
合計ジャッジ時間 4,371 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
13,124 KB
testcase_01 AC 50 ms
9,708 KB
testcase_02 AC 23 ms
6,544 KB
testcase_03 AC 56 ms
10,464 KB
testcase_04 AC 124 ms
13,532 KB
testcase_05 AC 103 ms
13,508 KB
testcase_06 AC 101 ms
13,620 KB
testcase_07 AC 127 ms
13,532 KB
testcase_08 AC 126 ms
13,504 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 51 ms
9,948 KB
testcase_13 AC 87 ms
13,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0