結果
問題 |
No.1242 高橋君とすごろく
|
ユーザー |
![]() |
提出日時 | 2020-10-02 23:58:56 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,335 bytes |
コンパイル時間 | 14,179 ms |
コンパイル使用メモリ | 378,572 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 02:51:57 |
合計ジャッジ時間 | 14,938 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 24 |
ソースコード
#[allow(unused_macros)] macro_rules! read_line_to_tuple { ( $( $t:ty ),* ) => {{ let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); let mut iter = input.split_whitespace(); ( $( iter.next().unwrap().parse::<$t>().unwrap() ),* ) }}; } #[allow(unused_macros)] macro_rules! read_line_to_collection { ( $t:ty ) => {{ let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); let iter = input.split_whitespace(); iter.map(|x| x.parse().unwrap()).collect::<$t>() }}; } fn main() { let (_n, k) = read_line_to_tuple!(i64, usize); let a = read_line_to_collection!(Vec<i64>); let mut v = vec![false; 100]; for i in 0..k { if a[i] < 100 { v[a[i] as usize] = true; } if a[i] > 20 { for j in 1..=5 { if i + j >= k { break; } let d = a[i + j] - a[i]; if d == 1 || d == 3 || d == 5 { v[1] = true; } } } } for i in (1..90).rev() { if v[i + 1] && v[i + 6] { v[i] = true; } if v[i + 2] && v[i + 5] { v[i] = true; } if v[i + 3] && v[i + 4] { v[i] = true; } } println!("{}", if v[1] { "No" } else { "Yes" }); }