-
Notifications
You must be signed in to change notification settings - Fork 0
/
Word_Game.cpp
64 lines (59 loc) · 1.13 KB
/
Word_Game.cpp
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
// https://codeforces.com/contest/1722/problem/C
#include<bits/stdc++.h>
#define int long long
#define gap ' '
#define pb push_back
using namespace std;
void solve() {
int n;
vector<string> v1,v2,v3;
map<string, int> m;
cin >> n;
string s;
for(int i = 0; i < n; i++) {
cin >> s;
v1.pb(s);
m[s]++;
}
for(int i = 0; i < n; i++) {
cin >> s;
v2.pb(s);
m[s]++;
}
for(int i = 0; i < n; i++) {
cin >> s;
v3.pb(s);
m[s]++;
}
int ans = 0;
for(auto x:v1) {
if(m[x] == 1) ans+=3;
else if(m[x] == 2) ans+=1;
}
cout << ans << gap;
ans = 0;
for(auto x:v2) {
if(m[x] == 1) ans+=3;
else if(m[x] == 2) ans+=1;
}
cout << ans << gap;
ans = 0;
for(auto x:v3) {
if(m[x] == 1) ans+=3;
else if(m[x] == 2) ans+=1;
}
cout << ans << endl;
}
signed main() {
//#ifndef ONLINE_JUDGE
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
//#endif
int t;
cin>>t;
while (t--)
{
solve();
}
return 0;
}