-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabandcompilationerrors.rs
55 lines (50 loc) · 1.47 KB
/
abandcompilationerrors.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use std::collections::HashMap;
struct Scan {
buffer: std::collections::VecDeque<String>
}
impl Scan {
fn new() -> Scan {
Scan { buffer: std::collections::VecDeque::new() }
}
fn next<T: std::str::FromStr>(&mut self)-> T {
loop {
if let Some(token) = self.buffer.pop_front() {
break token.parse::<T>().ok().unwrap();
}
let mut line = String::new();
std::io::stdin().read_line(&mut line).expect("Fail to read");
self.buffer = line.split_whitespace().map(String::from).collect();
}
}
}
fn _main() {
let mut scan = Scan::new();
let n: usize = scan.next();
let mut map: HashMap<usize, [usize; 3]> = HashMap::new();
for _ in 0..n {
let x: usize = scan.next::<usize>();
map.entry(x).and_modify(|x| {(*x)[0]+=1;}).or_insert([1,0,0]);
}
for _ in 0..n-1 {
let x = scan.next::<usize>();
map.entry(x).and_modify(|x| {(*x)[1]+=1;});
}
for _ in 0..n-2 {
let x = scan.next::<usize>();
map.entry(x).and_modify(|x| {(*x)[2]+=1;});
}
let mut sol: [usize;2] = [0, 0];
for (key, val) in map.iter() {
if (*val)[0] != (*val)[1] {
sol[0] = *key;
}
if (*val)[1] != (*val)[2] {
sol[1] = *key;
}
}
println!("{}\n{}", sol[0], sol[1]);
}
fn main() {
std::thread::Builder::new()
.stack_size(1<<23).spawn(_main).unwrap().join().unwrap();
}