結果

問題 No.709 優勝可能性
ユーザー maspymaspy
提出日時 2020-02-29 19:50:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 241 ms / 3,500 ms
コード長 1,082 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 108,832 KB
最終ジャッジ日時 2024-04-21 21:52:28
合計ジャッジ時間 5,915 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
52,224 KB
testcase_01 AC 47 ms
51,840 KB
testcase_02 AC 48 ms
52,096 KB
testcase_03 AC 48 ms
51,968 KB
testcase_04 AC 47 ms
51,840 KB
testcase_05 AC 48 ms
52,224 KB
testcase_06 AC 50 ms
51,840 KB
testcase_07 AC 48 ms
51,968 KB
testcase_08 AC 48 ms
51,968 KB
testcase_09 AC 48 ms
52,096 KB
testcase_10 AC 154 ms
88,832 KB
testcase_11 AC 128 ms
87,680 KB
testcase_12 AC 201 ms
92,648 KB
testcase_13 AC 239 ms
90,112 KB
testcase_14 AC 225 ms
89,600 KB
testcase_15 AC 226 ms
88,448 KB
testcase_16 AC 233 ms
88,192 KB
testcase_17 AC 241 ms
108,832 KB
testcase_18 AC 48 ms
52,224 KB
testcase_19 AC 47 ms
52,352 KB
testcase_20 AC 221 ms
96,432 KB
testcase_21 AC 229 ms
96,180 KB
testcase_22 AC 48 ms
51,712 KB
testcase_23 AC 48 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
N, M = map(int, readline().split())
querys = readlines()


# %%
best_param_cnt = [0] * N
best_param = [0] * M
best_param_member = [[] for _ in range(M)]
can_win_cnt = 0


# %%
def solve():
    global can_win_cnt
    for n, line in enumerate(querys):
        R = map(int, line.split())
        for m, x in enumerate(R):
            if x < best_param[m]:
                continue
            if x == best_param[m]:
                best_param_member[m].append(n)
                best_param_cnt[n] += 1
                continue
            best_param[m] = x
            best_param_cnt[n] += 1
            for k in best_param_member[m]:
                best_param_cnt[k] -= 1
                if best_param_cnt[k] == 0:
                    can_win_cnt -= 1
            best_param_member[m] = [n]
        can_win_cnt += (best_param_cnt[n] > 0)
        yield can_win_cnt


# %%
answers = solve()
print('\n'.join(map(str, answers)))


# %%
0