Skip to content

Commit 7d3cb49

Browse files
committed
add abc403c.rs
1 parent cf4a32f commit 7d3cb49

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

src/abc/abc403c.rs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
q:usize,
13+
}
14+
let mut memo = vec![false;n];
15+
let mut map = HashMap::new();
16+
17+
for i in 0..q {
18+
input! {
19+
t:usize
20+
}
21+
22+
if t == 1 {
23+
input! {
24+
x:Usize1,
25+
y:Usize1
26+
}
27+
28+
map.entry(x).or_insert(HashSet::new()).insert(y);
29+
30+
} else if t == 2 {
31+
input! {
32+
x:Usize1
33+
}
34+
35+
memo[x] = true;
36+
37+
} else {
38+
input! {
39+
x:Usize1,
40+
y:Usize1
41+
}
42+
43+
if memo[x] {
44+
println!("Yes");
45+
} else {
46+
if let Some(set) = map.get(&x) {
47+
if set.contains(&y) {
48+
println!("Yes");
49+
} else {
50+
println!("No");
51+
}
52+
} else {
53+
println!("No");
54+
}
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)