結果

問題 No.233 めぐるはめぐる (3)
ユーザー yuruhiya
提出日時 2020-10-21 19:14:10
言語 Crystal
(1.14.0)
結果
RE  
実行時間 -
コード長 540 bytes
コンパイル時間 12,299 ms
コンパイル使用メモリ 300,068 KB
実行使用メモリ 20,600 KB
最終ジャッジ日時 2024-06-30 21:27:44
合計ジャッジ時間 17,101 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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