結果

問題 No.233 めぐるはめぐる (3)
ユーザー nebukuro09nebukuro09
提出日時 2016-11-02 13:12:16
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 790 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 29,136 KB
最終ジャッジ日時 2023-09-02 22:41:54
合計ジャッジ時間 5,193 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,924 KB
testcase_01 AC 32 ms
9,868 KB
testcase_02 AC 18 ms
7,468 KB
testcase_03 AC 34 ms
11,652 KB
testcase_04 AC 192 ms
27,036 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 228 ms
28,588 KB
testcase_08 AC 220 ms
28,128 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 1 ms
4,368 KB
testcase_11 AC 1 ms
4,372 KB
testcase_12 AC 32 ms
10,832 KB
testcase_13 AC 65 ms
22,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;

void main() {
  int N = readln().chomp.to!int;
  bool[string] used;
  foreach (i; iota(N))
    used[readln().chomp] = true;

  string s1 = "iaaeuu";
  string s2 = "nbmgr";
  auto p1 = [0, 1, 2, 3, 4, 5];
  do {
    auto p2 = [0, 1, 2, 3, 4];
    do {
      string s3 = "";
      string s4 = "";
      foreach (i; iota(5)) {
        s3 ~= s1[p1[i]];
        s3 ~= s2[p2[i]];
        s4 ~= s2[p2[i]];
        s4 ~= s1[p1[i]];
      }
      if (!(s3~s1[p1[5]] in used)) {writeln(s3~s1[p1[5]]); return;}
      if (!(s4~s1[p1[5]] in used)) {writeln(s4~s1[p1[5]]); return;}
    } while(nextPermutation(p2));
  } while(nextPermutation(p1));
  
  writeln("NO");
}
0