結果

問題 No.709 優勝可能性
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-25 05:17:00
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 411 ms / 3,500 ms
コード長 814 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 87,108 KB
実行使用メモリ 105,936 KB
最終ジャッジ日時 2023-08-24 00:46:39
合計ジャッジ時間 6,977 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,008 KB
testcase_01 AC 67 ms
71,124 KB
testcase_02 AC 68 ms
71,252 KB
testcase_03 AC 67 ms
71,416 KB
testcase_04 AC 68 ms
71,132 KB
testcase_05 AC 68 ms
71,332 KB
testcase_06 AC 66 ms
71,424 KB
testcase_07 AC 68 ms
71,296 KB
testcase_08 AC 67 ms
71,164 KB
testcase_09 AC 67 ms
71,436 KB
testcase_10 AC 313 ms
78,232 KB
testcase_11 AC 300 ms
79,680 KB
testcase_12 AC 357 ms
78,480 KB
testcase_13 AC 381 ms
78,368 KB
testcase_14 AC 358 ms
78,252 KB
testcase_15 AC 363 ms
78,372 KB
testcase_16 AC 382 ms
80,852 KB
testcase_17 AC 411 ms
105,936 KB
testcase_18 AC 67 ms
71,316 KB
testcase_19 AC 68 ms
71,276 KB
testcase_20 AC 373 ms
78,244 KB
testcase_21 AC 381 ms
78,236 KB
testcase_22 AC 67 ms
71,284 KB
testcase_23 AC 68 ms
71,320 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
s=[[] for i in range(m)]#各パラメーターごとの最高値保持者リスト
maxnum=[0]*m#各パラメーターの最高値
ncnt=[0]*n#各人の最高値保有個数
now=0#最高値保持者数

for i in range(n):
    a=list(map(int,input().split()))
    for j in range(m):
        if a[j] == maxnum[j]:
            s[j].append(i)
            if ncnt[i] == 0:
                now+=1
            ncnt[i] += 1
            
        elif a[j] > maxnum[j]:
            for k in range(len(s[j])):
                t=s[j].pop()
                ncnt[t] -= 1
                if ncnt[t] == 0:
                    now -= 1
            s[j].append(i)
            if ncnt[i] == 0:
                now+=1
            ncnt[i] += 1
            maxnum[j] = a[j]

    print(now)
            
    

0