結果
| 問題 |
No.709 優勝可能性
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-02 11:54:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 226 ms / 3,500 ms |
| コード長 | 751 bytes |
| コンパイル時間 | 339 ms |
| コンパイル使用メモリ | 82,316 KB |
| 実行使用メモリ | 105,428 KB |
| 最終ジャッジ日時 | 2024-11-14 15:26:13 |
| 合計ジャッジ時間 | 5,618 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
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)