257072026-02-27 15:19:23algoproBejgli (80 pont)cpp17Accepted 80/8032ms820 KiB
// UUID: 9983674a-c4d0-4a13-ba85-1b0bc34df9f1
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> rtz(n);
	for (int i = 0; i < n; i++) {
		cin >> rtz[i];
	}
	int max = rtz[0];
	for (int i = 1; i < n; i++) {
		if (max < rtz[i]) {
			max = rtz[i];
		}
	}
	vector<int> megoldás(max+1);
	for (int i = 0; i < n; i++) {
		megoldás[rtz[i]]++;
	}
	int elso = 0;
	for (int i = 1; i <= max; i++) {
		megoldás[i] = megoldás[i] / i;
		elso+= megoldás[i];
	}
	cout << elso << '\n';
	int max2 = megoldás[1];
	int index = 1;
	for (int i = 2; i <= max; i++) {
		if (max2 < megoldás[i]) {
			max2 = megoldás[i];
			index = i;
		}
	}
	cout << index;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/01ms508 KiB
2Accepted0/01ms512 KiB
3Accepted4/41ms316 KiB
4Accepted4/41ms316 KiB
5Accepted4/41ms316 KiB
6Accepted4/41ms380 KiB
7Accepted4/41ms500 KiB
8Accepted4/41ms316 KiB
9Accepted4/41ms368 KiB
10Accepted4/41ms316 KiB
11Accepted4/41ms316 KiB
12Accepted4/42ms316 KiB
13Accepted4/43ms508 KiB
14Accepted4/44ms316 KiB
15Accepted4/44ms316 KiB
16Accepted4/44ms512 KiB
17Accepted4/410ms564 KiB
18Accepted4/418ms804 KiB
19Accepted4/426ms564 KiB
20Accepted4/426ms800 KiB
21Accepted4/432ms820 KiB
22Accepted4/420ms800 KiB