68962023-12-19 14:59:42999Bejgli (80 pont)cpp17Wrong answer 52/8034ms4676 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
base52/80
1Accepted0/03ms1812 KiB
2Wrong answer0/03ms2156 KiB
3Partially correct2/43ms2328 KiB
4Partially correct2/43ms2540 KiB
5Partially correct2/43ms2648 KiB
6Accepted4/43ms2732 KiB
7Partially correct2/43ms2976 KiB
8Partially correct2/43ms3060 KiB
9Accepted4/43ms3188 KiB
10Partially correct2/43ms3404 KiB
11Partially correct2/43ms3404 KiB
12Partially correct2/44ms3440 KiB
13Partially correct2/44ms3520 KiB
14Partially correct2/44ms3512 KiB
15Accepted4/46ms3784 KiB
16Partially correct2/46ms3852 KiB
17Accepted4/413ms3860 KiB
18Partially correct2/420ms4424 KiB
19Partially correct2/426ms4556 KiB
20Accepted4/428ms4596 KiB
21Accepted4/434ms4676 KiB
22Partially correct2/423ms4676 KiB