結果
| 問題 | 
                            No.233 めぐるはめぐる (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kazu0x17
                         | 
                    
| 提出日時 | 2015-07-04 01:35:02 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,172 bytes | 
| コンパイル時間 | 1,210 ms | 
| コンパイル使用メモリ | 170,176 KB | 
| 実行使用メモリ | 13,568 KB | 
| 最終ジャッジ日時 | 2024-07-07 22:50:36 | 
| 合計ジャッジ時間 | 4,554 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 7 WA * 4 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]){
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  set<string> used;
  
  for (int i = 0; i < n; i++) {
    string tmp;
    cin >> tmp;
    used.insert(tmp);
  }
  char vowel[] = {'i', 'a', 'a', 'e', 'u', 'u'};
  char consonant[] = {'n', 'b', 'm', 'g', 'r'};
  sort(vowel, vowel + 6);
  sort(consonant, consonant + 5);
  bool ok;
  string ans;
  char tmp;
  do{
    do{
      ok = true;
      for (int i = 0; i < 6; i++) {
        ans = "";
        int seq = 0;
        for (int j = 0; j < 5; j++) {
          if(i == j){
            tmp = vowel[j];
            ans += tmp;
            seq++;
          }
          tmp = consonant[j];
          ans += tmp;
          tmp = vowel[j + seq];
          ans += tmp;
        }
        if(seq == 0)ans += vowel[5];
        if(used.find(ans) != used.end())
          ok = false;
        if(ok)break;
      }
      if(ok)break;
    }while(next_permutation(consonant, consonant + 5));
    if(ok)break;
  }while(next_permutation(vowel, vowel + 6));
  if(ok)std::cout << ans << std::endl;
  else std::cout << "𝙽𝙾" << std::endl;
  
  return 0;
}
            
            
            
        
            
kazu0x17