結果

問題 No.233 めぐるはめぐる (3)
ユーザー KKT89KKT89
提出日時 2020-07-14 11:42:56
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 930 bytes
コンパイル時間 1,322 ms
コンパイル使用メモリ 119,944 KB
実行使用メモリ 22,196 KB
最終ジャッジ日時 2023-08-10 19:21:21
合計ジャッジ時間 6,775 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
13,048 KB
testcase_01 AC 50 ms
9,772 KB
testcase_02 AC 22 ms
6,456 KB
testcase_03 AC 54 ms
10,540 KB
testcase_04 AC 342 ms
21,848 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 375 ms
21,860 KB
testcase_08 AC 382 ms
21,988 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 48 ms
9,740 KB
testcase_13 AC 88 ms
13,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
using namespace std;
typedef long long int ll;
using ull = unsigned long long;

map<string,int> mp;
vector<int> v(11);
string s="inabameguru";

bool ok(char c){
    return (c=='a'||c=='i'||c=='u'||c=='e'||c=='o');
}

void dfs(string t,int n){
    if(n==11&&!mp[t]&&ok(t.back())){
        cout << t << endl;
        exit(0);
    }
    for(int i=0;i<11;i++){
        if(v[i])continue;
        if(!ok(t.back())&&!ok(s[i]))continue;
        v[i]=1;
        dfs(t+s[i],n+1);
        v[i]=0;
    }
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s="inabameguru";
    int n; cin >> n;
    while(n--){
        string t; cin >> t;
        mp[t]=1;
    }
    dfs("",0);
    printf("NO\n");
}
0