結果
問題 |
No.233 めぐるはめぐる (3)
|
ユーザー |
|
提出日時 | 2020-07-14 11:42:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 930 bytes |
コンパイル時間 | 1,178 ms |
コンパイル使用メモリ | 117,620 KB |
最終ジャッジ日時 | 2025-01-11 20:29:08 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 2 |
ソースコード
#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"); }