結果
問題 |
No.1946 ロッカーの問題
|
ユーザー |
|
提出日時 | 2022-09-09 03:42:50 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 960 bytes |
コンパイル時間 | 15,575 ms |
コンパイル使用メモリ | 403,860 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-25 01:12:58 |
合計ジャッジ時間 | 17,068 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 14 |
ソースコード
fn main() { let (n, _m) = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse::<usize>().unwrap(), iter.next().unwrap().parse::<usize>().unwrap(), ) }; let aa = { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|x| x.parse::<usize>().unwrap()) .collect::<Vec<_>>() }; let mut actual = vec![false; n + 1]; for &a in aa.iter() { actual[a] = true; } let mut ans = 0_u32; let mut lockers = vec![false; n + 1]; for i in 1..=n { if lockers[i] == actual[i] { ans += 1; } else { for j in (i..=n).step_by(i) { lockers[j] = !lockers[j]; } } } println!("{}", ans); }