forked from derekhh/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathacm-icpc-team.cpp
More file actions
44 lines (41 loc) · 816 Bytes
/
acm-icpc-team.cpp
File metadata and controls
44 lines (41 loc) · 816 Bytes
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
/*
acm-icpc-team.cpp
ACM ICPC Team
*/
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<vector<bool> > v;
int main() {
int n, m;
cin >> n >> m;
v.resize(n);
for (int i = 0; i < n; i++) {
v[i].resize(m);
string str;
cin >> str;
for (int j = 0; j < m; j++) {
v[i][j] = str[j] - '0';
}
}
int maxTopic = 0, maxCnt = 0;
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
int cntTopic = 0;
for (int k = 0; k < m; k++) {
if (v[i][k] || v[j][k]) {
cntTopic++;
}
}
if (cntTopic > maxTopic) {
maxTopic = cntTopic;
maxCnt = 1;
} else if (cntTopic == maxTopic) {
maxCnt++;
}
}
}
cout << maxTopic << endl << maxCnt << endl;
return 0;
}