Submission #7034267
Source Code Expand
fn read<T: std::str::FromStr>() -> T {
let mut s = String::new();
std::io::stdin().read_line(&mut s).ok();
s.trim().parse().ok().unwrap()
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
read::<String>().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}
fn main() {
let nq = read_vec::<i32>();
let (n, q) = (nq[0], nq[1]);
// initialize
let mut field: Vec<i32> = Vec::new();
for _ in 0..n {
field.push(0)
}
for _ in 0..q {
let lr = read_vec::<i32>();
let (l, r) = (lr[0] - 1, lr[1]);
field[l as usize] += 1;
if r < n { field[r as usize] -= 1 }
}
for i in 1..n {
field[i as usize] = field[(i-1) as usize] + field[i as usize]
}
for f in field {
print!("{}", if f % 2 == 0 { '0' } else { '1' });
}
println!();
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - オセロ |
| User | tkhr |
| Language | Rust (1.15.1) |
| Score | 100 |
| Code Size | 840 Byte |
| Status | AC |
| Exec Time | 91 ms |
| Memory | 4476 KiB |
Judge Result
| Set Name | Sample | Subtask1 | All | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 60 / 60 | 40 / 40 | ||||||
| Status |
|
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_example_01.txt, 00_example_02.txt |
| Subtask1 | 00_example_01.txt, 00_example_02.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 10_small_07.txt, 10_small_08.txt, 10_small_09.txt, 10_small_10.txt |
| All | 00_example_01.txt, 00_example_02.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 10_small_07.txt, 10_small_08.txt, 10_small_09.txt, 10_small_10.txt, 20_rand_01.txt, 20_rand_02.txt, 20_rand_03.txt, 20_rand_04.txt, 20_rand_05.txt, 20_rand_06.txt, 20_rand_07.txt, 20_rand_08.txt, 20_rand_09.txt, 20_rand_10.txt, 30_max_01.txt, 30_max_02.txt, 30_max_03.txt, 30_max_04.txt, 30_max_05.txt, 40_corner_01.txt, 40_corner_02.txt, 40_corner_03.txt, 40_corner_04.txt, 40_corner_05.txt, 40_corner_06.txt, 40_corner_07.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_example_01.txt | AC | 2 ms | 4352 KiB |
| 00_example_02.txt | AC | 2 ms | 4352 KiB |
| 10_small_01.txt | AC | 2 ms | 4352 KiB |
| 10_small_02.txt | AC | 2 ms | 4352 KiB |
| 10_small_03.txt | AC | 2 ms | 4352 KiB |
| 10_small_04.txt | AC | 2 ms | 4352 KiB |
| 10_small_05.txt | AC | 2 ms | 4352 KiB |
| 10_small_06.txt | AC | 2 ms | 4352 KiB |
| 10_small_07.txt | AC | 2 ms | 4352 KiB |
| 10_small_08.txt | AC | 2 ms | 4352 KiB |
| 10_small_09.txt | AC | 2 ms | 4352 KiB |
| 10_small_10.txt | AC | 2 ms | 4352 KiB |
| 20_rand_01.txt | AC | 39 ms | 4352 KiB |
| 20_rand_02.txt | AC | 11 ms | 4352 KiB |
| 20_rand_03.txt | AC | 16 ms | 4476 KiB |
| 20_rand_04.txt | AC | 24 ms | 4352 KiB |
| 20_rand_05.txt | AC | 10 ms | 4352 KiB |
| 20_rand_06.txt | AC | 26 ms | 4352 KiB |
| 20_rand_07.txt | AC | 17 ms | 4476 KiB |
| 20_rand_08.txt | AC | 5 ms | 4352 KiB |
| 20_rand_09.txt | AC | 14 ms | 4352 KiB |
| 20_rand_10.txt | AC | 9 ms | 4352 KiB |
| 30_max_01.txt | AC | 87 ms | 4476 KiB |
| 30_max_02.txt | AC | 87 ms | 4476 KiB |
| 30_max_03.txt | AC | 87 ms | 4476 KiB |
| 30_max_04.txt | AC | 87 ms | 4476 KiB |
| 30_max_05.txt | AC | 86 ms | 4476 KiB |
| 40_corner_01.txt | AC | 48 ms | 4352 KiB |
| 40_corner_02.txt | AC | 80 ms | 4476 KiB |
| 40_corner_03.txt | AC | 80 ms | 4476 KiB |
| 40_corner_04.txt | AC | 91 ms | 4476 KiB |
| 40_corner_05.txt | AC | 75 ms | 4476 KiB |
| 40_corner_06.txt | AC | 48 ms | 4352 KiB |
| 40_corner_07.txt | AC | 82 ms | 4476 KiB |