Skip to content

Commit 4de1756

Browse files
committed
add abc406d.rs
1 parent b138da5 commit 4de1756

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

src/abc/abc406d.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/** THIS IS AN OUTPUT FILE. NOT EDIT THIS FILE DIRECTLY. **/
2+
use proconio::input;
3+
use proconio::marker::*;
4+
use std::marker::PhantomData;
5+
use std::cmp::*;
6+
use std::collections::*;
7+
8+
fn main() {
9+
input! {
10+
h:usize,
11+
w:usize,
12+
n:usize,
13+
yx: [(Usize1, Usize1); n],
14+
q:usize,
15+
query: [(usize, Usize1); q],
16+
}
17+
18+
let mut rows = vec![HashSet::new(); h];
19+
let mut cols = vec![HashSet::new(); w];
20+
for (y, x) in yx {
21+
rows[y].insert(x);
22+
cols[x].insert(y);
23+
}
24+
25+
for (t,v) in query {
26+
if t == 1 {
27+
let y = v;
28+
let set = &rows[y];
29+
println!(
30+
"{}", set.len()
31+
);
32+
33+
for x in set {
34+
cols[*x].remove(&y);
35+
}
36+
rows[y].clear();
37+
} else {
38+
let x = v;
39+
let set = &cols[x];
40+
println!(
41+
"{}", set.len()
42+
);
43+
44+
for y in set {
45+
rows[*y].remove(&x);
46+
}
47+
cols[x].clear();
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)