-
Notifications
You must be signed in to change notification settings - Fork 2
/
a_and_b_and_compilation_errors_519B.rs
82 lines (64 loc) · 1.79 KB
/
a_and_b_and_compilation_errors_519B.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// https://codeforces.com/problemset/problem/519/B
// map, sorting
use std::io;
use std::collections::HashMap;
fn print_missing(first: &HashMap<i64,i64>, second: &HashMap<i64,i64>) {
for (key, value) in first {
match second.get(key) {
Some(item) => {
if item != value {
println!("{}", key);
}
}
None => println!("{}", key),
}
}
}
fn fill_map_with_vector(first: &mut HashMap<i64, i64>, values: &Vec<i64>) {
for item in values {
let count = first.entry(*item).or_insert(0);
*count += 1;
}
}
fn main() {
let mut n = String::new();
io::stdin()
.read_line(&mut n)
.unwrap();
let _n: i64 = n.trim().parse().unwrap();
let mut line = String::new();
io::stdin()
.read_line(&mut line)
.unwrap();
let a: Vec<i64> =
line
.split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
let mut line = String::new();
io::stdin()
.read_line(&mut line)
.unwrap();
let b: Vec<i64> =
line
.split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
let mut line = String::new();
io::stdin()
.read_line(&mut line)
.unwrap();
let c: Vec<i64> =
line
.split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
let mut errors_first = HashMap::new();
let mut errors_second = HashMap::new();
let mut errors_third = HashMap::new();
fill_map_with_vector(&mut errors_first, &a);
fill_map_with_vector(&mut errors_second, &b);
fill_map_with_vector(&mut errors_third, &c);
print_missing(&errors_first, &errors_second);
print_missing(&errors_second, &errors_third);
}