Skip to content

Commit cf4a32f

Browse files
committed
add abc402c.rs
1 parent e8424ba commit cf4a32f

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/abc/abc402c.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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+
n:usize,
11+
m:usize,
12+
}
13+
14+
let mut memo = vec![HashSet::new();m];
15+
let mut map = HashMap::new();
16+
for i in 0..m {
17+
input! {
18+
k:usize,
19+
a:[usize;k]
20+
}
21+
22+
for j in 0..k {
23+
let aj = a[j];
24+
map.entry(aj).or_insert(vec![]).push(i);
25+
memo[i].insert(aj);
26+
}
27+
}
28+
29+
let mut result = 0;
30+
input! {
31+
b:[usize;n]
32+
}
33+
34+
for i in b {
35+
if let Some(arr) = map.remove(&i) {
36+
for j in arr {
37+
memo[j].remove(&i);
38+
if memo[j].is_empty() {
39+
result += 1;
40+
}
41+
}
42+
}
43+
println!("{}", result);
44+
}
45+
}

0 commit comments

Comments
 (0)