-
Notifications
You must be signed in to change notification settings - Fork 0
/
10887.cpp
41 lines (33 loc) · 913 Bytes
/
10887.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
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ll t; ll cs = 0;
while(cin >> t){
ll cs = 0;
while(t--){
ll m,n; cin >> m >> n;
cin.ignore(1000, '\n');
string A[m], B[n];
set<string> C;
for(ll i = 0; i < m; i++){
getline(cin, A[i]);
}
for(ll i = 0; i < n; i++){
getline(cin, B[i]);
}
for(ll i = 0; i < m; i++){
for(ll j = 0; j < n; j++){
string hi = A[i] + B[j];
C.insert(hi);
}
}
cout << "Case " << ++cs << ": " << C.size() << "\n";
}
}
return 0;
}