10092022-02-23 12:08:46CzDaniKert (75 pont)cpp14Hibás válasz 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;
}	
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/75
1Elfogadva0/02ms1740 KiB
2Hibás válasz0/0194ms9640 KiB
3Elfogadva4/41ms5768 KiB
4Részben helyes2/41ms5772 KiB
5Részben helyes2/41ms5784 KiB
6Részben helyes2/41ms5780 KiB
7Részben helyes2/42ms5796 KiB
8Részben helyes2/41ms5800 KiB
9Részben helyes2/41ms5804 KiB
10Részben helyes2/44ms5852 KiB
11Részben helyes3/62ms5876 KiB
12Részben helyes3/68ms6100 KiB
13Részben helyes3/623ms6784 KiB
14Részben helyes3/6185ms13664 KiB
15Részben helyes3/6187ms18260 KiB
16Részben helyes3/6214ms21584 KiB
17Részben helyes4/7107ms21772 KiB