結果

問題 No.489 株に挑戦
ユーザー hanorverhanorver
提出日時 2017-02-27 23:03:32
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 945 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 86,644 KB
実行使用メモリ 93,476 KB
最終ジャッジ日時 2023-09-02 13:28:03
合計ジャッジ時間 21,654 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 742 ms
90,892 KB
testcase_01 AC 660 ms
89,704 KB
testcase_02 AC 75 ms
73,544 KB
testcase_03 AC 75 ms
73,060 KB
testcase_04 AC 76 ms
73,404 KB
testcase_05 AC 78 ms
73,344 KB
testcase_06 AC 96 ms
78,156 KB
testcase_07 AC 96 ms
78,164 KB
testcase_08 AC 77 ms
73,452 KB
testcase_09 AC 97 ms
78,080 KB
testcase_10 AC 97 ms
78,148 KB
testcase_11 AC 100 ms
78,140 KB
testcase_12 AC 99 ms
78,284 KB
testcase_13 AC 98 ms
78,244 KB
testcase_14 AC 98 ms
78,248 KB
testcase_15 AC 195 ms
81,260 KB
testcase_16 TLE -
testcase_17 AC 240 ms
81,992 KB
testcase_18 AC 664 ms
87,908 KB
testcase_19 AC 599 ms
87,308 KB
testcase_20 TLE -
testcase_21 AC 422 ms
85,132 KB
testcase_22 AC 240 ms
82,104 KB
testcase_23 AC 533 ms
86,468 KB
testcase_24 TLE -
testcase_25 AC 99 ms
78,200 KB
testcase_26 AC 890 ms
92,168 KB
testcase_27 AC 887 ms
93,384 KB
testcase_28 AC 75 ms
73,340 KB
testcase_29 AC 76 ms
73,408 KB
testcase_30 AC 884 ms
93,464 KB
testcase_31 AC 874 ms
92,632 KB
testcase_32 AC 713 ms
90,480 KB
testcase_33 TLE -
testcase_34 AC 951 ms
91,816 KB
testcase_35 AC 529 ms
86,492 KB
testcase_36 AC 318 ms
83,300 KB
testcase_37 AC 631 ms
88,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

INF=-1000000007
N,D,K = map(int,input().split())
x = [int(input()) for i in range(N)]
seg = []
size = 1 << 17
seg=[[INF,INF]]* (size*2)
def seg_update(i,X):
	tmp=[X,i]
	i = size+i-1
	seg[i]=tmp
	while i > 0:
		i = (i-1)>>1
		s1=seg[i*2+1];s2=seg[i*2+2]
		if s1[0] < s2[0]:
			seg[i] = s2
		elif s1[0] > s2[0]:
			seg[i] = s1
		else:
			if s1[1] < s2[1]:
				seg[i] = s1
			else:
				seg[i] = s2

def seg_query(a,b,k,l,r):
	if r <= a or b <= l:
		return [INF,INF]
	if a <= l and r <= b:
		return seg[k]
	c = 2 * k
	d = (l + r) // 2

	left=seg_query(a,b,c+1,l,d)
	right=seg_query(a,b,c+2,d,r)
	if left[0] < right[0] or (right[0] >= left[0] and left[1] >= right[1]):
		return right
	return left
for i in range(N):
	seg_update(i,x[i])
ans=INF
pair=[INF,INF]
for i in range(N-1):
	ret=seg_query(i+1,min(N,i+D+1),0,0,size+1)
	if ans < ret[0]-x[i]:
		ans=ret[0]-x[i]
		pair=[i,ret[1]]
if ans <= 0:
	print(0)
else:
	print(ans*K)
	print(pair[0],pair[1])
0