結果

問題 No.233 めぐるはめぐる (3)
ユーザー kazu0x17kazu0x17
提出日時 2015-07-04 00:45:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,168 bytes
コンパイル時間 1,483 ms
コンパイル使用メモリ 151,416 KB
実行使用メモリ 7,660 KB
最終ジャッジ日時 2023-09-22 06:02:45
合計ジャッジ時間 5,893 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 79 ms
7,448 KB
testcase_08 AC 76 ms
7,660 KB
testcase_09 AC 27 ms
4,380 KB
testcase_10 AC 28 ms
4,380 KB
testcase_11 AC 27 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
char v[] = {'a', 'i', 'u', 'e', 'o'};

int main(int argc, char *argv[]){
  int n;
  cin >> n;
  string used[n];
  for (int i = 0; i < n; i++) {
    cin >> used[i];
  }
  string vowel = "iaaeuu";
  string consonant = "nbmgr";
  sort(vowel.begin(), vowel.end());
  sort(consonant.begin(), consonant.end());
  bool ok;
  string ans;
  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){
            ans += vowel.substr(j, 1);
            seq++;
          }
          ans += consonant.substr(j, 1) + vowel.substr(j + seq, 1);
          //std::cout << ans << std::endl;
        }
        if(seq == 0)ans += vowel.substr(5, 1);
        for (int i = 0; i < n; i++) {
          if(used[i] != ans)continue;
          ok = false;
          break;
        }
        if(!ok)break;
      }
    }while(next_permutation(consonant.begin(), consonant.end()));
    if(!ok)break;
  }while(next_permutation(vowel.begin(), vowel.end()));
  if(ok)std::cout << ans << std::endl;
  else std::cout << "NO" << std::endl;

  return 0;
}

0