結果

問題 No.2100 [Cherry Alpha C] Two-way Steps
ユーザー 👑 p-adicp-adic
提出日時 2023-05-22 12:17:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 472 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 52,948 KB
最終ジャッジ日時 2023-08-23 21:43:02
合計ジャッジ時間 53,150 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,328 KB
testcase_01 RE -
testcase_02 AC 16 ms
8,236 KB
testcase_03 RE -
testcase_04 AC 1,209 ms
45,184 KB
testcase_05 AC 1,024 ms
40,512 KB
testcase_06 RE -
testcase_07 AC 149 ms
14,292 KB
testcase_08 AC 981 ms
39,700 KB
testcase_09 AC 1,099 ms
42,140 KB
testcase_10 AC 1,042 ms
35,708 KB
testcase_11 AC 760 ms
34,184 KB
testcase_12 AC 706 ms
32,000 KB
testcase_13 RE -
testcase_14 AC 898 ms
33,724 KB
testcase_15 RE -
testcase_16 AC 908 ms
36,124 KB
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 1,374 ms
49,836 KB
testcase_20 AC 227 ms
17,320 KB
testcase_21 AC 631 ms
29,784 KB
testcase_22 AC 876 ms
34,956 KB
testcase_23 AC 935 ms
39,248 KB
testcase_24 AC 1,466 ms
52,876 KB
testcase_25 AC 1,529 ms
52,872 KB
testcase_26 AC 1,485 ms
52,872 KB
testcase_27 AC 1,474 ms
52,792 KB
testcase_28 AC 1,509 ms
52,836 KB
testcase_29 AC 1,499 ms
52,836 KB
testcase_30 AC 1,498 ms
52,800 KB
testcase_31 AC 1,477 ms
52,948 KB
testcase_32 AC 1,436 ms
52,872 KB
testcase_33 AC 1,469 ms
52,772 KB
testcase_34 AC 1,534 ms
49,548 KB
testcase_35 AC 1,569 ms
48,644 KB
testcase_36 AC 1,578 ms
48,488 KB
testcase_37 AC 1,596 ms
47,572 KB
testcase_38 AC 1,540 ms
49,140 KB
testcase_39 AC 1,529 ms
44,336 KB
testcase_40 AC 1,504 ms
44,412 KB
testcase_41 AC 1,496 ms
44,368 KB
testcase_42 AC 1,455 ms
44,484 KB
testcase_43 AC 1,483 ms
44,468 KB
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
権限があれば一括ダウンロードができます

ソースコード

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)
N-=1
C,D,E,F=[-1]*M,[-1]*M,[-1]*M,[-1]*M
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