結果

問題 No.233 めぐるはめぐる (3)
ユーザー yuruhiyayuruhiya
提出日時 2020-10-21 19:10:34
言語 Crystal
(1.11.2)
結果
AC  
実行時間 252 ms / 1,000 ms
コード長 699 bytes
コンパイル時間 19,874 ms
コンパイル使用メモリ 259,392 KB
実行使用メモリ 53,024 KB
最終ジャッジ日時 2023-09-13 12:23:01
合計ジャッジ時間 23,723 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 198 ms
51,588 KB
testcase_01 AC 202 ms
52,972 KB
testcase_02 AC 200 ms
53,024 KB
testcase_03 AC 203 ms
51,932 KB
testcase_04 AC 214 ms
52,308 KB
testcase_05 AC 235 ms
51,508 KB
testcase_06 AC 241 ms
52,052 KB
testcase_07 AC 252 ms
52,628 KB
testcase_08 AC 251 ms
51,952 KB
testcase_09 AC 195 ms
53,016 KB
testcase_10 AC 193 ms
52,012 KB
testcase_11 AC 196 ms
52,232 KB
testcase_12 AC 197 ms
51,628 KB
testcase_13 AC 203 ms
51,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

lib C
  fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64
end

class String
  def to_i64
    C.strtoll(self, nil, 10)
  end
end

vowel, cons = "iaaeuu", "nbmgr"
size = vowel.size + cons.size

strings = [] of String
(0...6).each { |vowel_pos|
  f = [0, 1] * 5
  f.insert({0, vowel_pos * 2 - 1}.max, 1)

  vowel.chars.each_permutation { |v|
    cons.chars.each_permutation { |c|
      v_i, c_i = -1, -1
      strings << (0...size).map { |i|
        if f[i] == 0
          c_i += 1
          c[c_i]
        else
          v_i += 1
          v[v_i]
        end
      }.join
    }
  }
}

n = read_line.to_i
s = (1..n).map { read_line }.to_set

puts strings.find { |str| !s.includes?(str) } || "NO"
0