結果

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

ソースコード

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 1..n {
        let mut flg = false;
        if let Ok(_) = x.binary_search(&i) {
            flg = true;
        }
        if t > tm[i] - tm[i - 1] {
            if t <= tm[n - 1] - tm[i - 1] && flg {
                t += 10;
                cnt += 1;
            }
        } else if flg {
            t += 10;
            cnt += 1;
        } else {
            println!("-1");
            return;
        }
        t -= tm[i] - tm[i - 1];
    }
    println!("{}", cnt)
}
0