結果

問題 No.2684 折々の色
ユーザー tomeruntomerun
提出日時 2024-03-20 21:46:32
言語 Crystal
(1.11.2)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 13,291 ms
コンパイル使用メモリ 293,908 KB
実行使用メモリ 78,616 KB
最終ジャッジ日時 2024-03-20 21:47:08
合計ジャッジ時間 30,508 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 274 ms
52,436 KB
testcase_12 AC 169 ms
35,256 KB
testcase_13 AC 309 ms
55,864 KB
testcase_14 AC 152 ms
27,300 KB
testcase_15 AC 206 ms
36,668 KB
testcase_16 AC 42 ms
14,960 KB
testcase_17 AC 153 ms
32,716 KB
testcase_18 AC 284 ms
56,436 KB
testcase_19 AC 320 ms
53,168 KB
testcase_20 AC 194 ms
37,396 KB
testcase_21 AC 61 ms
17,124 KB
testcase_22 AC 338 ms
57,388 KB
testcase_23 AC 212 ms
39,092 KB
testcase_24 AC 102 ms
25,364 KB
testcase_25 AC 144 ms
32,816 KB
testcase_26 AC 304 ms
53,072 KB
testcase_27 AC 202 ms
33,156 KB
testcase_28 AC 213 ms
38,884 KB
testcase_29 AC 532 ms
77,684 KB
testcase_30 AC 538 ms
78,240 KB
testcase_31 AC 511 ms
75,772 KB
testcase_32 AC 566 ms
78,008 KB
testcase_33 AC 562 ms
76,708 KB
testcase_34 AC 510 ms
78,224 KB
testcase_35 AC 564 ms
77,268 KB
testcase_36 AC 491 ms
78,240 KB
testcase_37 AC 518 ms
78,616 KB
testcase_38 AC 585 ms
76,892 KB
testcase_39 AC 561 ms
76,892 KB
testcase_40 AC 585 ms
76,892 KB
testcase_41 AC 548 ms
76,892 KB
testcase_42 AC 571 ms
76,892 KB
testcase_43 AC 554 ms
76,892 KB
testcase_44 AC 580 ms
76,892 KB
testcase_45 AC 551 ms
76,892 KB
testcase_46 AC 546 ms
76,892 KB
testcase_47 AC 2 ms
6,676 KB
testcase_48 AC 2 ms
6,676 KB
testcase_49 AC 2 ms
6,676 KB
testcase_50 AC 2 ms
6,676 KB
testcase_51 AC 2 ms
6,676 KB
testcase_52 AC 2 ms
6,676 KB
testcase_53 AC 2 ms
6,676 KB
testcase_54 AC 2 ms
6,676 KB
testcase_55 AC 2 ms
6,676 KB
testcase_56 AC 2 ms
6,676 KB
testcase_57 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = read_line.split.map(&.to_i)
x = read_line.split.map(&.to_i)
t = [] of Int32
cards = Hash(Array(Int32), Array(Int32)).new { |h, k| h[k] = [] of Int32 }
cs = Array.new(n) do |i|
  e = read_line.split.map(&.to_i)
  t << e[-1]
  cards[e[..-2].map { |v| v * t[-1] }] << i
  e[..-2]
end
z = Array.new(m, 0)
n.times do |i|
  if t[i] == 100
    if x == cs[i]
      puts "Yes"
      exit
    end
    next
  end
  ok = true
  m.times do |j|
    z[j] = 10000 * x[j] - 100 * t[i] * cs[i][j]
    if z[j] % (100 - t[i]) != 0
      ok = false
      break
    else
      z[j] //= (100 - t[i])
    end
  end
  next if !ok
  if !cards[z].select { |v| v != i }.empty?
    puts "Yes"
    exit
  end
end
puts "No"
0