File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments