結果

問題 No.504 ゲーム大会(ランキング)
ユーザー n3k2t1n3k2t1
提出日時 2019-07-22 00:53:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 320 bytes
コンパイル時間 1,343 ms
コンパイル使用メモリ 10,596 KB
実行使用メモリ 13,384 KB
最終ジャッジ日時 2023-09-05 10:46:45
合計ジャッジ時間 4,956 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,460 KB
testcase_01 AC 16 ms
7,924 KB
testcase_02 AC 16 ms
8,108 KB
testcase_03 AC 16 ms
7,916 KB
testcase_04 AC 16 ms
7,912 KB
testcase_05 AC 16 ms
7,904 KB
testcase_06 AC 17 ms
7,908 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush, heapify

N = int(input())

pq = []

for i in range(N):
    a = int(input())
    heappush(pq, (-a, i))
    pq2 = []
    for j in range(i + 1):
        p = heappop(pq)
        pq2.append(p)
        if p[1] == 0:
            print(j + 1)
            break
    pq += pq2
    heapify(pq)
0