結果
| 問題 |
No.1673 Lamps on a line
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-25 17:02:16 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 398 bytes |
| コンパイル時間 | 21,649 ms |
| コンパイル使用メモリ | 377,520 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-06-25 17:02:43 |
| 合計ジャッジ時間 | 16,718 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 TLE * 1 -- * 5 |
ソースコード
use std::io::Read;
fn main() {
let mut s = String::new();
std::io::stdin().read_to_string(&mut s).ok();
let n: Vec<usize> = s.split_whitespace().flat_map(str::parse).collect();
let mut d = vec![0; n[0] + 1];
for i in n[2..].chunks(2) {
d[i[0] - 1] += 1;
d[i[1]] -= 1;
let (mut a, mut c) = (0, 0);
for d in &d {
c += d;
if c % 2 == 1 {
a += 1
}
}
println!("{a}")
}
}