blob: 035150d4bd599e60f67f086c59d0a04b869389d7 (
plain)
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
|
#include <bits/stdc++.h>
using namespace std;
int K[101];
string charact[101][101];
int main() {
ifstream cin("guess.in");
ofstream cout("guess.out");
int N;
cin >> N;
for (int i = 0; i < N; ++i) {
string name;
cin >> name;
cin >> K[i];
for (int j = 0; j < K[i]; ++j) cin >> charact[i][j];
}
int ans = 0;
for (int a = 0; a < N; ++a) {
for (int b = a + 1; b < N; ++b) {
int cnt = 0; // a and b are the two animals
for (int i = 0; i < K[a]; ++i) {
bool found = false;
// search for a's charact in b's characts
for (int j = 0; j < K[b]; ++j) {
if (charact[a][i] == charact[b][j]) found = true;
}
if (found == true) ++cnt;
}
ans = max(cnt + 1, ans);
}
}
cout << ans;
}
|