結果

問題 No.3252 Constrained Moving
コンテスト
ユーザー Mogobon
提出日時 2025-09-05 21:35:33
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 93 ms / 2,000 ms
+ 406µs
コード長 298 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 702 ms
コンパイル使用メモリ 95,976 KB
実行使用メモリ 116,224 KB
最終ジャッジ日時 2026-07-14 15:04:00
合計ジャッジ時間 6,221 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,S,T,K=map(int,input().split())
a=list(map(int,input().split()))
mn,mni=10**9+1,-1
for i in range(N):
    if mn > a[i]:
        mn = a[i]
        mni = i

# Ai + At <= K ?
if a[S-1] + a[T-1] <= K:
    print(1)
elif a[S-1] + a[mni] <= K and a[mni] + a[T-1] <= K:
    print(2)
else:
    print(-1)


0