結果
問題 |
No.2836 Comment Out
|
ユーザー |
|
提出日時 | 2024-08-09 22:41:05 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 684 bytes |
コンパイル時間 | 12,858 ms |
コンパイル使用メモリ | 377,880 KB |
実行使用メモリ | 6,144 KB |
最終ジャッジ日時 | 2024-08-09 22:41:21 |
合計ジャッジ時間 | 14,021 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 WA * 23 |
ソースコード
fn main() { proconio::input! { n: usize, a: [i64; n], } let is_possible_from_front = a .iter() .scan(0, |acc, &x| { *acc = x.max(*acc - 1); Some(*acc <= 1) }) .collect::<Vec<_>>(); let is_possible_from_back = a .iter() .rev() .scan(0, |acc, &x| { *acc = x.max(*acc - 1); Some(*acc <= 1) }) .collect::<Vec<_>>() .into_iter() .rev() .collect::<Vec<_>>(); if (0..n).any(|idx| is_possible_from_front[idx] && is_possible_from_back[idx]) { println!("Yes"); } else { println!("No"); } }