結果
| 問題 | No.709 優勝可能性 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-30 00:50:32 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 1,645 ms / 3,500 ms |
| コード長 | 480 bytes |
| 記録 | |
| コンパイル時間 | 37 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 59,264 KB |
| 最終ジャッジ日時 | 2024-07-01 00:39:02 |
| 合計ジャッジ時間 | 16,322 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
コンパイルメッセージ
Syntax OK
ソースコード
N, M = gets.split.map &:to_i
R = $<.map{|s| s.split.map &:to_i }
maximum = M.times.map{ [0, []]}
counts = [0] * N
ans = 0
R.each_with_index{|r, i|
maximum = maximum.zip(r).map{|(max, idxs), x|
case x <=> max
when 1
idxs.each{|j|
counts[j] -= 1
ans -= 1 if counts[j] < 1
}
counts[i] += 1
[x, [i]]
when -1
[max, idxs]
else
counts[i] += 1
[max, idxs << i]
end
}
ans += 1 if counts[i] > 0
p ans
}