結果
| 問題 | No.709 優勝可能性 |
| コンテスト | |
| ユーザー |
kurimupy
|
| 提出日時 | 2020-06-18 01:28:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 836 ms / 3,500 ms |
| コード長 | 953 bytes |
| 記録 | |
| コンパイル時間 | 717 ms |
| コンパイル使用メモリ | 82,536 KB |
| 実行使用メモリ | 175,420 KB |
| 最終ジャッジ日時 | 2024-07-03 12:36:36 |
| 合計ジャッジ時間 | 9,492 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
from collections import deque
import heapq
N, M = map(int, input().split())
data = [[]for j in range(M)]
for i in range(N):
x = list(map(int, input().split()))
data.append(x)
for j in range(M):
data[j].append(x[j])
get_index = [[-1 for i in range(N)] for j in range(M)]
for i in range(M):
que = []
heapq.heapify(que)
X = data[i]
MAX = 0
for j in range(N):
heapq.heappush(que, (X[j], j))
MAX = max(X[j], MAX)
while que[0][0] < MAX:
value, index = heapq.heappop(que)
get_index[i][index] = j
for value, index in que:
get_index[i][index] = N
D = deque()
for i in range(N):
maxi = i
for j in range(M):
maxi = max(maxi, get_index[j][i])
D.append((i, 1))
D.append((maxi, -1))
ans = [0 for i in range(N+1)]
while D:
x, v = D.popleft()
ans[x] += v
for i in range(N):
ans[i+1] += ans[i]
for i in range(N):
print(ans[i])
kurimupy