結果

問題 No.318 学学学学学
ユーザー TawaraTawara
提出日時 2015-12-19 00:26:18
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,394 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 36,140 KB
最終ジャッジ日時 2023-09-04 18:21:43
合計ジャッジ時間 8,294 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
8,612 KB
testcase_01 AC 51 ms
10,888 KB
testcase_02 AC 60 ms
11,444 KB
testcase_03 AC 43 ms
9,868 KB
testcase_04 AC 53 ms
11,112 KB
testcase_05 AC 323 ms
36,140 KB
testcase_06 AC 732 ms
27,492 KB
testcase_07 AC 536 ms
24,760 KB
testcase_08 AC 335 ms
20,292 KB
testcase_09 AC 221 ms
18,764 KB
testcase_10 AC 162 ms
16,652 KB
testcase_11 AC 308 ms
36,016 KB
testcase_12 AC 235 ms
27,540 KB
testcase_13 AC 208 ms
24,716 KB
testcase_14 AC 191 ms
20,400 KB
testcase_15 AC 176 ms
18,680 KB
testcase_16 AC 160 ms
16,576 KB
testcase_17 AC 222 ms
26,868 KB
testcase_18 AC 206 ms
27,248 KB
testcase_19 AC 1,394 ms
26,888 KB
testcase_20 AC 153 ms
15,160 KB
testcase_21 AC 11 ms
6,124 KB
testcase_22 AC 12 ms
6,016 KB
testcase_23 AC 11 ms
6,124 KB
testcase_24 AC 11 ms
6,084 KB
testcase_25 AC 11 ms
5,992 KB
testcase_26 AC 12 ms
6,016 KB
testcase_27 AC 12 ms
6,072 KB
testcase_28 AC 12 ms
6,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect,insort
N=input()
a=(map(int,raw_input().split()))
b=[0]*N;p={};l=[]
for i,v in enumerate(a):
	if v in p:p[v][1]=i
	else:p[v]=[i,i]
for i,v in enumerate(a):
	b[i]=max(v,l[-1]) if l else v
	if i==p[v][0]:insort(l,v)
	if i==p[v][1]:del l[bisect(l,v)-1]
print " ".join(map(str,b))
0