結果

問題 No.3252 Constrained Moving
ユーザー しもりん
提出日時 2025-09-06 01:01:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 82,144 KB
実行使用メモリ 106,212 KB
最終ジャッジ日時 2025-09-06 01:02:02
合計ジャッジ時間 4,979 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import os



IS_LOCAL = os.environ.get("LOCAL") == "true"


def debug(*args, sep=" ", end="\n", flush=False) -> None:
    if IS_LOCAL:
        print(*args, sep=sep, end=end, file=sys.stderr, flush=flush)


def yn(flg: bool) -> bool:
    print('Yes' if flg else 'No')
    return flg


def main():
    readline = sys.stdin.readline

    N, S, T, K = map(int, readline().split())
    S -= 1
    T -= 1
    A = list(map(int, readline().split()))
    if A[S] + A[T] <= K:
        ans = 1
    elif max(A[S], A[T]) + min(A) <= K:
        ans = 2
    else:
        ans = -1
    print(ans)


if __name__ == "__main__":
    main()
0