結果

問題 No.3252 Constrained Moving
ユーザー urectanc
提出日時 2025-09-05 21:29:48
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 18,830 ms
コンパイル使用メモリ 399,692 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-05 21:30:40
合計ジャッジ時間 21,042 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

use proconio::{input, marker::Usize1};

fn main() {
    input! {
        n: usize, s: Usize1, t: Usize1, k: usize,
        a: [usize; n]
    }
    let min = a.iter().min().copied().unwrap();

    let ans = if a[s] + a[t] <= k {
        1
    } else {
        if a[s] + min <= k && a[t] + min <= k {
            2
        } else {
            -1
        }
    };
    println!("{ans}");
}
0