10112022-02-23 12:45:54CzDaniKert (75 pont)cpp14Wrong answer 40/75218ms25728 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 > ans2) {
				jo = true;
				ans2 = db;
			}
			else if (db == ans2) {
				jo = false;
			}
		}
		if (jo) {
			ans3++;
		}
	}
	cout << ans3 << endl << ans1;
}	
SubtaskSumTestVerdictTimeMemory
base40/75
1Accepted0/02ms1736 KiB
2Wrong answer0/0215ms13780 KiB
3Accepted4/41ms5660 KiB
4Partially correct2/41ms5764 KiB
5Partially correct2/41ms5772 KiB
6Partially correct2/41ms5784 KiB
7Partially correct2/41ms5784 KiB
8Partially correct2/41ms5792 KiB
9Partially correct2/42ms5796 KiB
10Partially correct2/44ms6016 KiB
11Partially correct3/62ms5872 KiB
12Partially correct3/68ms6256 KiB
13Partially correct3/623ms7244 KiB
14Partially correct3/6195ms17504 KiB
15Partially correct3/6187ms23252 KiB
16Partially correct3/6218ms25728 KiB
17Partially correct4/7112ms23812 KiB