結果

問題 No.709 優勝可能性
ユーザー lllllll88938494lllllll88938494
提出日時 2022-09-25 05:12:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 415 ms / 3,500 ms
コード長 669 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 86,992 KB
実行使用メモリ 106,156 KB
最終ジャッジ日時 2023-08-24 00:46:32
合計ジャッジ時間 8,375 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,332 KB
testcase_01 AC 72 ms
71,288 KB
testcase_02 AC 71 ms
71,100 KB
testcase_03 AC 72 ms
71,204 KB
testcase_04 AC 72 ms
71,396 KB
testcase_05 AC 71 ms
71,492 KB
testcase_06 AC 72 ms
71,220 KB
testcase_07 AC 71 ms
71,080 KB
testcase_08 AC 70 ms
71,352 KB
testcase_09 AC 72 ms
70,948 KB
testcase_10 AC 332 ms
78,148 KB
testcase_11 AC 314 ms
79,684 KB
testcase_12 AC 372 ms
78,428 KB
testcase_13 AC 388 ms
78,300 KB
testcase_14 AC 371 ms
78,312 KB
testcase_15 AC 383 ms
78,428 KB
testcase_16 AC 410 ms
81,064 KB
testcase_17 AC 415 ms
106,156 KB
testcase_18 AC 70 ms
71,332 KB
testcase_19 AC 72 ms
71,264 KB
testcase_20 AC 375 ms
78,336 KB
testcase_21 AC 384 ms
78,236 KB
testcase_22 AC 70 ms
71,360 KB
testcase_23 AC 70 ms
71,332 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