結果

問題 No.318 学学学学学
ユーザー TawaraTawara
提出日時 2015-12-19 00:27:56
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 572 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 2,547 ms
コンパイル使用メモリ 77,496 KB
実行使用メモリ 112,716 KB
最終ジャッジ日時 2023-09-04 18:22:49
合計ジャッジ時間 6,922 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
79,796 KB
testcase_01 AC 94 ms
82,004 KB
testcase_02 AC 117 ms
85,504 KB
testcase_03 AC 94 ms
80,824 KB
testcase_04 AC 113 ms
84,188 KB
testcase_05 AC 217 ms
112,716 KB
testcase_06 AC 349 ms
101,044 KB
testcase_07 AC 277 ms
96,580 KB
testcase_08 AC 203 ms
93,168 KB
testcase_09 AC 157 ms
91,020 KB
testcase_10 AC 133 ms
93,472 KB
testcase_11 AC 213 ms
112,408 KB
testcase_12 AC 178 ms
101,456 KB
testcase_13 AC 160 ms
96,968 KB
testcase_14 AC 147 ms
93,828 KB
testcase_15 AC 140 ms
91,712 KB
testcase_16 AC 124 ms
91,564 KB
testcase_17 AC 150 ms
102,056 KB
testcase_18 AC 166 ms
102,456 KB
testcase_19 AC 572 ms
102,012 KB
testcase_20 AC 132 ms
94,704 KB
testcase_21 AC 75 ms
76,540 KB
testcase_22 AC 75 ms
76,532 KB
testcase_23 AC 76 ms
76,364 KB
testcase_24 AC 75 ms
76,296 KB
testcase_25 AC 76 ms
76,432 KB
testcase_26 AC 75 ms
76,728 KB
testcase_27 AC 75 ms
76,288 KB
testcase_28 AC 76 ms
76,432 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