68972023-12-19 15:01:00999Bejgli (80 pont)cpp17Accepted 80/8034ms4968 KiB
// Source: https://usaco.guide/general/io

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

int main() {
	int n;cin>>n;
	int cnt=0;
	vector<int> v(n+1);
	map<int, int> m;
	for(int i = 1;i<=n;i++){
		cin>>v[i];
	}
	int j = 1;
	while(j<=n){
		cnt++;
		m[v[j]]++;
		j+=v[j];
	}
	cout<<cnt<<endl;
	int maxk=0;
	for(auto p : m){
		if(p.second>m[maxk])maxk=p.first;
	}
	cout<<maxk<<endl;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1816 KiB
2Accepted0/03ms2056 KiB
3Accepted4/43ms2260 KiB
4Accepted4/43ms2476 KiB
5Accepted4/43ms2512 KiB
6Accepted4/43ms2756 KiB
7Accepted4/43ms2848 KiB
8Accepted4/43ms2964 KiB
9Accepted4/43ms3104 KiB
10Accepted4/43ms3308 KiB
11Accepted4/43ms3416 KiB
12Accepted4/44ms3656 KiB
13Accepted4/44ms3884 KiB
14Accepted4/44ms3892 KiB
15Accepted4/46ms4248 KiB
16Accepted4/46ms4452 KiB
17Accepted4/413ms4500 KiB
18Accepted4/420ms4872 KiB
19Accepted4/426ms4872 KiB
20Accepted4/427ms4872 KiB
21Accepted4/434ms4868 KiB
22Accepted4/423ms4968 KiB