結果

問題 No.709 優勝可能性
ユーザー letrangerjpletrangerjp
提出日時 2018-06-30 00:50:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,644 ms / 3,500 ms
コード長 480 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 11,464 KB
実行使用メモリ 60,568 KB
最終ジャッジ日時 2023-09-13 15:59:20
合計ジャッジ時間 17,513 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,088 KB
testcase_01 AC 82 ms
15,268 KB
testcase_02 AC 77 ms
15,164 KB
testcase_03 AC 76 ms
15,072 KB
testcase_04 AC 77 ms
15,256 KB
testcase_05 AC 77 ms
15,072 KB
testcase_06 AC 80 ms
15,188 KB
testcase_07 AC 81 ms
15,264 KB
testcase_08 AC 82 ms
15,160 KB
testcase_09 AC 78 ms
15,252 KB
testcase_10 AC 754 ms
23,188 KB
testcase_11 AC 595 ms
23,872 KB
testcase_12 AC 1,256 ms
40,896 KB
testcase_13 AC 1,622 ms
55,924 KB
testcase_14 AC 1,585 ms
56,148 KB
testcase_15 AC 1,594 ms
55,888 KB
testcase_16 AC 1,610 ms
56,792 KB
testcase_17 AC 1,644 ms
60,568 KB
testcase_18 AC 77 ms
15,132 KB
testcase_19 AC 77 ms
15,128 KB
testcase_20 AC 1,609 ms
55,532 KB
testcase_21 AC 1,633 ms
55,716 KB
testcase_22 AC 77 ms
15,048 KB
testcase_23 AC 76 ms
15,124 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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
}
0