File tree 1 file changed +85
-0
lines changed
1 file changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ // ॐ नमः शिवाय
2
+ #include < bits/stdc++.h>
3
+ using namespace std ;
4
+
5
+ #define ll long long
6
+ #define pb push_back
7
+ #define ff first
8
+ #define ss second
9
+ #define mp make_pair
10
+
11
+ // Code Written By: Vikash Patel
12
+ // Codeforces Profile: https://codeforces.com/profile/vikashpatel
13
+
14
+ int main ()
15
+ {
16
+ ios_base::sync_with_stdio (0 );
17
+ cin.tie (0 );
18
+ cout.tie (0 );
19
+
20
+ // #ifndef ONLINE_JUDGE
21
+ // freopen("input.txt", "r", stdin);
22
+ // freopen("/Users/vikash/Desktop/output.txt", "w", stdout);
23
+ // #endif
24
+
25
+ int t;
26
+ cin>>t;
27
+ while (t--)
28
+ {
29
+ int n;
30
+ cin>>n;
31
+ string a[n], b[n], c[n];
32
+ unordered_map<string, int > mpa, mpb, mpc;
33
+ for (int i=0 ; i<n; i++)
34
+ {
35
+ cin>>a[i];
36
+ mpa[a[i]]++;
37
+ }
38
+ for (int i=0 ; i<n; i++)
39
+ {
40
+ cin>>b[i];
41
+ mpb[b[i]]++;
42
+ }
43
+ for (int i=0 ; i<n; i++)
44
+ {
45
+ cin>>c[i];
46
+ mpc[c[i]]++;
47
+ }
48
+ int pa = 0 , pb = 0 , pc = 0 ;
49
+ for (auto i : a)
50
+ {
51
+ if (mpa[i]>0 && mpb[i]>0 && mpc[i]>0 )
52
+ continue ;
53
+ else if (mpa[i]>0 && mpb[i]>0 )
54
+ pa++;
55
+ else if (mpa[i]>0 && mpc[i]>0 )
56
+ pa++;
57
+ else
58
+ pa += 3 ;
59
+ }
60
+ for (auto i : b)
61
+ {
62
+ if (mpa[i]>0 && mpb[i]>0 && mpc[i]>0 )
63
+ continue ;
64
+ else if (mpa[i]>0 && mpb[i]>0 )
65
+ pb++;
66
+ else if (mpb[i]>0 && mpc[i]>0 )
67
+ pb++;
68
+ else
69
+ pb += 3 ;
70
+ }
71
+ for (auto i : c)
72
+ {
73
+ if (mpa[i]>0 && mpb[i]>0 && mpc[i]>0 )
74
+ continue ;
75
+ else if (mpa[i]>0 && mpc[i]>0 )
76
+ pc++;
77
+ else if (mpb[i]>0 && mpc[i]>0 )
78
+ pc++;
79
+ else
80
+ pc += 3 ;
81
+ }
82
+ cout<<pa<<" " <<pb<<" " <<pc<<endl;
83
+ }
84
+ return 0 ;
85
+ }
You can’t perform that action at this time.
0 commit comments