結果
| 問題 | No.3252 Constrained Moving |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-05 21:50:21 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 608 bytes |
| 記録 | |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 96,236 KB |
| 実行使用メモリ | 123,520 KB |
| 最終ジャッジ日時 | 2026-07-14 15:13:52 |
| 合計ジャッジ時間 | 8,550 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 27 WA * 3 |
ソースコード
N,S,T,K=(int(x) for x in input().split())
A=list(map(int, input().split()))
if N == 2:
if A[0] + A[1] <= K:
print(1)
else:
print(-1)
exit()
if A[S-1] + A[T-1] <= K:
print(1)
exit()
if min(A) == A[S-1]:
if A[S-1] + A[T-1] <= K:
print(1)
else:
print(-1)
exit()
a = A[T-1]
res=[]
for i in range(1, N+1):
res.append([A[i-1], i])
res = sorted(res, key=lambda x: x[0])
if min(A) == a:
if a + res[1][0] <= K:
print(2)
else:
print(-1)
else:
if res[0][0] + a <= K:
print(2)
else:
print(-1)