結果

問題 No.318 学学学学学
ユーザー maspymaspy
提出日時 2020-03-07 05:25:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 436 ms / 2,000 ms
コード長 616 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 45,876 KB
最終ジャッジ日時 2024-04-22 11:51:55
合計ジャッジ時間 7,560 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
13,696 KB
testcase_01 AC 75 ms
16,384 KB
testcase_02 AC 88 ms
17,668 KB
testcase_03 AC 68 ms
15,512 KB
testcase_04 AC 80 ms
16,944 KB
testcase_05 AC 436 ms
45,876 KB
testcase_06 AC 338 ms
41,056 KB
testcase_07 AC 275 ms
36,348 KB
testcase_08 AC 236 ms
35,084 KB
testcase_09 AC 203 ms
33,772 KB
testcase_10 AC 165 ms
31,848 KB
testcase_11 AC 402 ms
45,236 KB
testcase_12 AC 270 ms
38,056 KB
testcase_13 AC 213 ms
35,052 KB
testcase_14 AC 194 ms
34,188 KB
testcase_15 AC 176 ms
33,128 KB
testcase_16 AC 160 ms
32,104 KB
testcase_17 AC 291 ms
35,912 KB
testcase_18 AC 263 ms
38,696 KB
testcase_19 AC 213 ms
41,032 KB
testcase_20 AC 154 ms
28,060 KB
testcase_21 AC 31 ms
10,880 KB
testcase_22 AC 31 ms
10,880 KB
testcase_23 AC 32 ms
10,752 KB
testcase_24 AC 31 ms
10,752 KB
testcase_25 AC 30 ms
10,752 KB
testcase_26 AC 30 ms
10,880 KB
testcase_27 AC 30 ms
10,752 KB
testcase_28 AC 30 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import defaultdict
from heapq import heappop, heappush

# %%
N, *A = map(int, read().split())

# %%
coord = defaultdict(list)
for i, x in enumerate(A):
    coord[x].append(i)


# %%
L_to_R = [-1] * N
for li in coord.values():
    L_to_R[li[0]] = li[-1]


# %%
q = []
B = [0] * N
for L, R in enumerate(L_to_R):
    if R != -1:
        heappush(q, (-A[L], R))
    while q[0][1] < L:
        heappop(q)
    B[L] = -q[0][0]

# %%
print(' '.join(map(str, B)))
0