75672024-01-09 18:03:57AblablablaBejgli (80 pont)cpp17Accepted 80/8035ms5628 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> szamok(n, 0);
    for(int i = 0; i < n; i++){
        cin >> szamok[i];
    }

    int ind = 0;
    vector<int> db(n, 0);
    int valasz = 0;
    while(ind < n){
        db[szamok[ind] - 1]++;
        ind += szamok[ind];
        valasz++;
    }

    cout << valasz << "\n";

    int maxi = 0, maxInd = 0;
    for(int i = 0; i < n; i++){
        if(maxi < db[i]){
            maxi = db[i];
            maxInd = i;
        }
    }

    cout << maxInd + 1 << "\n";
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1852 KiB
2Accepted0/03ms2152 KiB
3Accepted4/43ms2400 KiB
4Accepted4/43ms2564 KiB
5Accepted4/43ms2756 KiB
6Accepted4/43ms2848 KiB
7Accepted4/43ms2912 KiB
8Accepted4/43ms3008 KiB
9Accepted4/43ms3020 KiB
10Accepted4/43ms3156 KiB
11Accepted4/43ms3388 KiB
12Accepted4/43ms3288 KiB
13Accepted4/44ms3580 KiB
14Accepted4/44ms3572 KiB
15Accepted4/46ms3768 KiB
16Accepted4/47ms4108 KiB
17Accepted4/413ms4744 KiB
18Accepted4/420ms5612 KiB
19Accepted4/428ms5616 KiB
20Accepted4/428ms5628 KiB
21Accepted4/435ms5624 KiB
22Accepted4/424ms5528 KiB