結果

問題 No.233 めぐるはめぐる (3)
ユーザー yuruhiyayuruhiya
提出日時 2020-10-21 19:14:10
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 540 bytes
コンパイル時間 19,140 ms
コンパイル使用メモリ 260,712 KB
実行使用メモリ 22,096 KB
最終ジャッジ日時 2023-09-13 12:23:50
合計ジャッジ時間 24,239 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
In Main.cr:20:9

 20 | Array.product(vowel.chars.permutations, cons.chars.permutations).map { |(v, c)|
            ^------
Warning: Deprecated Array(T).product. Use `Indexable.cartesian_product(indexables : Indexable(Indexable))` instead

A total of 1 warnings were found.

ソースコード

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

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

puts (0...6).flat_map { |vowel_pos|
  f = [0, 1] * 5
  f.insert({0, vowel_pos * 2 - 1}.max, 1)
  Array.product(vowel.chars.permutations, cons.chars.permutations).map { |(v, c)|
    (0...11).map { |i| (f[i] == 0 ? c : v).shift(1)[0] }.join
  }
}.find { |str| !s.includes?(str) } || "NO"
0