結果
| 問題 |
No.2836 Comment Out
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-09 22:38:14 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 619 bytes |
| コンパイル時間 | 11,819 ms |
| コンパイル使用メモリ | 401,708 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-08-09 22:38:30 |
| 合計ジャッジ時間 | 14,085 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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<_>>();
if (0..n).any(|idx| is_possible_from_front[idx] && is_possible_from_back[idx]) {
println!("Yes");
} else {
println!("No");
}
}