結果

問題 No.1679 マスゲーム
ユーザー simansiman
提出日時 2022-03-06 01:56:10
言語 Ruby
(3.3.0)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 38 ms
コンパイル使用メモリ 11,244 KB
実行使用メモリ 23,316 KB
最終ジャッジ日時 2023-09-27 15:33:39
合計ジャッジ時間 8,975 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
15,068 KB
testcase_01 AC 73 ms
15,136 KB
testcase_02 AC 71 ms
15,132 KB
testcase_03 AC 413 ms
22,836 KB
testcase_04 AC 427 ms
23,100 KB
testcase_05 AC 423 ms
22,556 KB
testcase_06 AC 421 ms
23,112 KB
testcase_07 AC 432 ms
22,840 KB
testcase_08 AC 422 ms
22,464 KB
testcase_09 AC 427 ms
22,740 KB
testcase_10 AC 423 ms
23,316 KB
testcase_11 AC 429 ms
22,564 KB
testcase_12 AC 103 ms
16,576 KB
testcase_13 AC 213 ms
18,908 KB
testcase_14 AC 435 ms
22,888 KB
testcase_15 AC 368 ms
22,732 KB
testcase_16 AC 328 ms
22,120 KB
testcase_17 AC 75 ms
15,128 KB
testcase_18 AC 368 ms
15,268 KB
testcase_19 AC 73 ms
15,252 KB
testcase_20 AC 74 ms
15,172 KB
testcase_21 AC 75 ms
15,128 KB
testcase_22 AC 75 ms
15,240 KB
testcase_23 AC 71 ms
15,112 KB
testcase_24 AC 75 ms
15,140 KB
testcase_25 AC 76 ms
15,272 KB
testcase_26 AC 75 ms
15,132 KB
testcase_27 AC 72 ms
15,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i

v_counter = Hash.new(0)
h_counter = Hash.new(0)

N.times do
  a, b, t = gets.split.map(&:to_i)

  if a == 0
    v_counter[b - t] += 1
  else
    h_counter[b - t] += 1
  end
end

ans = 0

v_counter.each do |t, cnt|
  ans += h_counter[t] * cnt
end

puts ans
0