-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathACM ICPC Team
34 lines (33 loc) · 888 Bytes
/
ACM ICPC Team
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
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(){
int n,l;
int topics = 0, temp = 0;
string m[500];
int teams[500];
cin >> n >> l;
for (int i = 0; i < n; i++){
cin >> m[i];
}
for (int i = 0; i < n; i++){
for (int j = i + 1; j < n; j++){
topics = 0;
for (int k = 0; k < l; k++){
if (m[i][k] == '1' || m[j][k] == '1'){
// check the k-th element of string m[i] is '1' or '0' if it's '1' count++.
// Ex: 101010 the 1st element is '1' so count++.
topics++;
if (temp < topics){
temp = topics;
}
}
}
if (temp == topics){
teams[temp]++;
}
}
}
cout << temp << endl << teams[temp];
return 0;
}