結果

問題 No.3252 Constrained Moving
ユーザー Yakumo221
提出日時 2025-09-06 03:55:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 336 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 82,684 KB
実行使用メモリ 107,868 KB
最終ジャッジ日時 2025-09-06 03:55:58
合計ジャッジ時間 5,363 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

n,s,t,k = map(int, input().split())
alist = list(map(int, input().split()))

ai = alist[s-1]
aj = alist[t-1]

if (ai + aj) <= k:
	print(1)
	exit()

if ai >= k:
	print(-1)
	exit()
if aj >= k:
	print(-1)
	exit()
	
	
alist[s-1] = 1 << 60
alist[t-1] = 1 << 60

x = min(alist)
if ((ai + x) <= k) & ((aj + x) <= k):
	print(2)
else:
	print(-1)
0