62992023-11-13 21:31:06xxxBejgli (80 pont)cpp14Accepted 80/8035ms6808 KiB
// Source: https://usaco.guide/general/io

#include <bits/stdc++.h>
using namespace std;

int db[100001];

int main() {
	int n;
	cin  >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	int ans = 0;

	for(int i = 0; i < n; i++) {
		db[a[i]]++;
		i += a[i];
		i--;
		ans++;
	}

	int maxs = INT_MIN, ans2 = 0;

	for(int i = 1; i <= 100000; i++) {
		if (maxs < db[i]) {
			maxs = db[i];
			ans2 = i;
		}
	}

	cout << ans << '\n' << ans2 << '\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1996 KiB
2Accepted0/03ms2128 KiB
3Accepted4/43ms2348 KiB
4Accepted4/43ms2304 KiB
5Accepted4/43ms2412 KiB
6Accepted4/43ms2904 KiB
7Accepted4/43ms3048 KiB
8Accepted4/43ms3216 KiB
9Accepted4/43ms3096 KiB
10Accepted4/43ms3336 KiB
11Accepted4/44ms3584 KiB
12Accepted4/44ms3576 KiB
13Accepted4/44ms3740 KiB
14Accepted4/44ms3732 KiB
15Accepted4/46ms3780 KiB
16Accepted4/46ms3968 KiB
17Accepted4/413ms4236 KiB
18Accepted4/420ms5096 KiB
19Accepted4/427ms5572 KiB
20Accepted4/428ms5988 KiB
21Accepted4/435ms6616 KiB
22Accepted4/423ms6808 KiB