結果

問題 No.2100 [Cherry Alpha C] Two-way Steps
ユーザー 👑 p-adicp-adic
提出日時 2023-05-22 12:21:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,743 ms / 2,000 ms
コード長 472 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 10,956 KB
実行使用メモリ 50,748 KB
最終ジャッジ日時 2023-08-23 08:52:28
合計ジャッジ時間 38,394 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,244 KB
testcase_01 AC 16 ms
8,140 KB
testcase_02 AC 16 ms
8,144 KB
testcase_03 AC 16 ms
8,196 KB
testcase_04 AC 1,322 ms
43,052 KB
testcase_05 AC 1,083 ms
37,720 KB
testcase_06 AC 116 ms
12,864 KB
testcase_07 AC 154 ms
14,060 KB
testcase_08 AC 1,025 ms
39,224 KB
testcase_09 AC 1,184 ms
38,928 KB
testcase_10 AC 1,111 ms
32,088 KB
testcase_11 AC 828 ms
32,964 KB
testcase_12 AC 782 ms
29,588 KB
testcase_13 AC 452 ms
25,560 KB
testcase_14 AC 870 ms
30,616 KB
testcase_15 AC 567 ms
27,764 KB
testcase_16 AC 966 ms
32,892 KB
testcase_17 AC 190 ms
18,140 KB
testcase_18 AC 494 ms
26,128 KB
testcase_19 AC 1,464 ms
47,264 KB
testcase_20 AC 236 ms
16,696 KB
testcase_21 AC 653 ms
27,960 KB
testcase_22 AC 922 ms
32,036 KB
testcase_23 AC 992 ms
37,624 KB
testcase_24 AC 1,591 ms
50,628 KB
testcase_25 AC 1,586 ms
50,508 KB
testcase_26 AC 1,547 ms
50,392 KB
testcase_27 AC 1,580 ms
50,608 KB
testcase_28 AC 1,550 ms
50,468 KB
testcase_29 AC 1,508 ms
50,548 KB
testcase_30 AC 1,553 ms
50,748 KB
testcase_31 AC 1,563 ms
50,460 KB
testcase_32 AC 1,565 ms
50,520 KB
testcase_33 AC 1,566 ms
50,556 KB
testcase_34 AC 1,668 ms
44,700 KB
testcase_35 AC 1,743 ms
43,692 KB
testcase_36 AC 1,682 ms
43,628 KB
testcase_37 AC 1,693 ms
42,928 KB
testcase_38 AC 1,733 ms
44,320 KB
testcase_39 AC 1,637 ms
39,804 KB
testcase_40 AC 1,605 ms
39,700 KB
testcase_41 AC 1,632 ms
39,780 KB
testcase_42 AC 1,647 ms
39,828 KB
testcase_43 AC 1,663 ms
39,568 KB
testcase_44 AC 612 ms
42,488 KB
testcase_45 AC 607 ms
42,420 KB
testcase_46 AC 549 ms
39,132 KB
testcase_47 AC 560 ms
39,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

P,U=print,max
def J():
	return map(int,input().split())
N,M=J()
H=list(J())
R=range(M)
Z,W=[[] for j in R],[[] for j in R]
for j in R:
	X,Y=J()
	X-=1
	Y-=1
	Z[j],W[j]=[X,Y],[Y,X]
Z.sort()
W.sort(reverse=1)
C,D,E,F=[-1]*N,[-1]*N,[-1]*N,[-1]*N
N-=1
C[0]=D[N]=0
for c,e,z in [C,E,Z],[D,F,W]:
	for x in z:
		X,Y=x[0],x[1]
		h=H[Y]-H[X]
		if c[X]>=0:
			if h>0:e[Y]=U(e[Y],c[X]+h)
			else:c[Y]=U(c[Y],c[X])
		if e[X]>=0 and h<0:c[Y]=U(c[Y],e[X])
P(U(C[N],E[N]))
P(U(D[0],F[0]))
0