結果

問題 No.1390 Get together
コンテスト
ユーザー masashi0217
提出日時 2021-03-22 07:07:33
言語 Ruby
(4.0.2)
コンパイル:
ruby -w -c _filename_
実行:
ruby _filename_
結果
WA  
実行時間 -
コード長 267 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 496 ms
コンパイル使用メモリ 8,960 KB
実行使用メモリ 23,732 KB
最終ジャッジ日時 2026-05-17 08:53:44
合計ジャッジ時間 7,906 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - m
Syntax OK

ソースコード

diff #
raw source code

n, m = gets.chomp.split(" ").map(&:to_i)
hash = Hash.new(0)
count = 0
iru = Hash.new(0)
n.times do
    b, c = gets.chomp.split(" ").map(&:to_i)
    count += 1 if hash[c] >= 1
    count -= 1 if iru[c] == b && hash[c] >= 1
    iru[c] = b
    hash[c] += 1
end
puts count
0