結果

問題 No.709 優勝可能性
ユーザー roarisroaris
提出日時 2021-06-02 11:54:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 271 ms / 3,500 ms
コード長 751 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 108,032 KB
最終ジャッジ日時 2023-08-09 08:49:07
合計ジャッジ時間 7,353 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
71,908 KB
testcase_01 AC 88 ms
71,384 KB
testcase_02 AC 90 ms
71,920 KB
testcase_03 AC 91 ms
71,584 KB
testcase_04 AC 90 ms
71,672 KB
testcase_05 AC 88 ms
71,812 KB
testcase_06 AC 89 ms
71,384 KB
testcase_07 AC 92 ms
71,864 KB
testcase_08 AC 88 ms
71,548 KB
testcase_09 AC 89 ms
71,728 KB
testcase_10 AC 170 ms
79,708 KB
testcase_11 AC 152 ms
79,640 KB
testcase_12 AC 206 ms
79,964 KB
testcase_13 AC 271 ms
100,524 KB
testcase_14 AC 230 ms
82,228 KB
testcase_15 AC 229 ms
80,956 KB
testcase_16 AC 237 ms
84,084 KB
testcase_17 AC 261 ms
108,032 KB
testcase_18 AC 86 ms
71,844 KB
testcase_19 AC 91 ms
71,748 KB
testcase_20 AC 229 ms
80,816 KB
testcase_21 AC 225 ms
80,692 KB
testcase_22 AC 88 ms
71,552 KB
testcase_23 AC 88 ms
71,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, M = map(int, input().split())
Ma = [0]*M
cnt = [0]*N
ans = 0
idx = [defaultdict(list) for _ in range(M)]

for i in range(N):
    R = list(map(int, input().split()))
    
    for j in range(M):
        if R[j]==Ma[j]:
            if cnt[i]==0:
                ans += 1
            
            cnt[i] += 1
            idx[j][Ma[j]].append(i)
        elif R[j]>Ma[j]:
            for k in idx[j][Ma[j]]:
                cnt[k] -= 1
                
                if cnt[k]==0:
                    ans -= 1
            
            if cnt[i]==0:
                ans += 1
            
            cnt[i] += 1
            Ma[j] = R[j]
            idx[j][Ma[j]].append(i)

    print(ans)
0