10152022-02-23 17:47:02CzDaniKert (75 pont)cpp14Accepted 75/75231ms25788 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define int long long

int n, m, p, ans1, ans2, ans3;
vector<vector<int> > v;

signed main() {
	cin >> n >> m >> p;
	v.resize(n+1, vector<int>(m+1));
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> v[i][j];
		}
	}
	for (int i = 1; i <= n; i++) {
		int db = 0, t = 0;;
		for (int l = 1; l <= m; l++) {
			if (v[i][l] == t) {
				db++;
				ans1 = max(ans1, db);
			}
			else {
				t = v[i][l];
				db = 1;
				ans1 = max(ans1, db);
			}
		}
	}
	for (int i = 1; i <= n; i++) {
		sort(v[i].begin(), v[i].end());
		bool jo = false;
		int db = 0, t = 0;
		for (int j = 1; j <= m; j++) {
			if (v[i][j] == t) {
				db++;
			}
			else {
				t = v[i][j];
				db = 1;
			}
			if (db > m / 2) {
				jo = true;
			}
		}
		if (jo) {
			ans3++;
		}
	}
	cout << ans3 << endl << ans1;
}	
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/02ms1748 KiB
2Accepted0/0224ms13864 KiB
3Accepted4/41ms5764 KiB
4Accepted4/41ms5768 KiB
5Accepted4/41ms5768 KiB
6Accepted4/41ms5788 KiB
7Accepted4/41ms5792 KiB
8Accepted4/41ms5784 KiB
9Accepted4/42ms5808 KiB
10Accepted4/44ms6028 KiB
11Accepted6/62ms5884 KiB
12Accepted6/68ms6316 KiB
13Accepted6/623ms7260 KiB
14Accepted6/6199ms17616 KiB
15Accepted6/6196ms23356 KiB
16Accepted6/6231ms25788 KiB
17Accepted7/7115ms23848 KiB