結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-09 02:08:27 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 779 bytes |
| コンパイル時間 | 12,874 ms |
| コンパイル使用メモリ | 386,736 KB |
| 実行使用メモリ | 13,640 KB |
| 最終ジャッジ日時 | 2024-11-14 10:09:32 |
| 合計ジャッジ時間 | 26,148 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 3 |
ソースコード
fn main() {
let mut buf = String::new();
let mut input = {
use std::io::Read;
std::io::stdin().read_to_string(&mut buf).unwrap();
buf.split_whitespace()
};
let n: usize = input.next().unwrap().parse().unwrap();
let q: usize = input.next().unwrap().parse().unwrap();
let lr: Vec<(usize, usize)> = (0..q)
.map(|_| {
(
input.next().unwrap().parse().unwrap(),
input.next().unwrap().parse().unwrap(),
)
})
.collect();
let mut lamps = vec![0; n];
for i in 0..q {
for j in (lr[i].0 - 1)..=(lr[i].1 - 1) {
lamps[j] ^= 1;
}
let ans = lamps.iter().filter(|&&x| x == 1).count();
println!("{}", ans);
}
}