結果

問題 No.3067 +10 Seconds Clock
ユーザー kyotoku1483
提出日時 2025-03-26 12:28:01
言語 Rust
(1.83.0 + proconio)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 24,729 ms
コンパイル使用メモリ 401,736 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-26 12:28:30
合計ジャッジ時間 27,549 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#[allow(unused)]
use proconio::{input, marker::Chars};

fn main() {
    input! {
        n: usize,
        mut t: i32,
        mut tm: [i32; n - 1],
        k: usize,
        x: [usize; k],
    }
    tm.insert(0, 0);
    for i in 1..n {
        tm[i] += tm[i - 1];
    }
    let mut cnt = 0;
    for i in 0..n - 1 {
        if t > tm[i + 1] - tm[i] {
            t -= tm[i + 1] - tm[i];
            if t <= tm[n - 1] - tm[i + 1] {
                if let Ok(_) = x.binary_search(&(i + 1)) {
                    t += 10;
                    cnt += 1;
                }
            }
        } else {
            println!("-1");
            return;
        }
    }
    println!("{}", cnt)
}
0