結果

問題 No.709 優勝可能性
ユーザー maimai
提出日時 2018-06-30 00:38:21
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,003 ms / 3,500 ms
コード長 627 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 11,584 KB
実行使用メモリ 23,108 KB
最終ジャッジ日時 2023-09-13 15:58:02
合計ジャッジ時間 12,237 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,368 KB
testcase_01 AC 78 ms
15,160 KB
testcase_02 AC 77 ms
15,140 KB
testcase_03 AC 79 ms
15,132 KB
testcase_04 AC 78 ms
15,332 KB
testcase_05 AC 77 ms
15,368 KB
testcase_06 AC 79 ms
15,324 KB
testcase_07 AC 77 ms
15,084 KB
testcase_08 AC 76 ms
15,352 KB
testcase_09 AC 78 ms
15,252 KB
testcase_10 AC 648 ms
16,228 KB
testcase_11 AC 547 ms
16,264 KB
testcase_12 AC 801 ms
16,260 KB
testcase_13 AC 950 ms
16,164 KB
testcase_14 AC 924 ms
16,276 KB
testcase_15 AC 900 ms
16,608 KB
testcase_16 AC 953 ms
18,920 KB
testcase_17 AC 1,003 ms
23,108 KB
testcase_18 AC 78 ms
15,268 KB
testcase_19 AC 78 ms
15,324 KB
testcase_20 AC 924 ms
16,108 KB
testcase_21 AC 916 ms
16,248 KB
testcase_22 AC 77 ms
15,304 KB
testcase_23 AC 78 ms
15,044 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ascan; gets.split.map(&:to_i); end

N, M = ascan

params = nil

degree = [0]*N
degree[0] = M
count = 1

N.times do |i|
    player = ascan
    if !params
        params = player.map{|e| [e,[i]]}
    else
        M.times do |j|
            if params[j][0] < player[j]
                params[j][1].each do |id|
                    count -= 1 if (degree[id] -= 1) == 0
                end
                params[j] = [player[j], []]
            end
            if params[j][0] <= player[j]
                params[j][1] << i
                count += 1 if (degree[i] += 1) == 1
            end
        end
    end
    p count
end
0