結果

問題 No.233 めぐるはめぐる (3)
ユーザー KKT89KKT89
提出日時 2020-07-14 11:44:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,022 bytes
コンパイル時間 1,402 ms
コンパイル使用メモリ 121,188 KB
実行使用メモリ 39,040 KB
最終ジャッジ日時 2024-04-28 12:41:53
合計ジャッジ時間 8,767 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
13,184 KB
testcase_01 AC 59 ms
9,728 KB
testcase_02 AC 24 ms
6,528 KB
testcase_03 AC 69 ms
10,368 KB
testcase_04 AC 883 ms
35,328 KB
testcase_05 AC 777 ms
31,360 KB
testcase_06 AC 712 ms
29,952 KB
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 58 ms
9,600 KB
testcase_13 AC 114 ms
13,312 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(t.size()&&!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);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s="inabameguru";
    int n; cin >> n;
    while(n--){
        string t; cin >> t;
        mp[t]=1;
    }
    dfs("",0);
    printf("NO\n");
}
0