10092022-02-23 12:08:46CzDaniKert (75 pont)cpp14Wrong answer 40/75214ms21772 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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

int 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/02ms1740 KiB
2Wrong answer0/0194ms9640 KiB
3Accepted4/41ms5768 KiB
4Partially correct2/41ms5772 KiB
5Partially correct2/41ms5784 KiB
6Partially correct2/41ms5780 KiB
7Partially correct2/42ms5796 KiB
8Partially correct2/41ms5800 KiB
9Partially correct2/41ms5804 KiB
10Partially correct2/44ms5852 KiB
11Partially correct3/62ms5876 KiB
12Partially correct3/68ms6100 KiB
13Partially correct3/623ms6784 KiB
14Partially correct3/6185ms13664 KiB
15Partially correct3/6187ms18260 KiB
16Partially correct3/6214ms21584 KiB
17Partially correct4/7107ms21772 KiB