43142023-03-23 13:38:28DalmBejgli (80 pont)cpp11Accepted 80/8035ms5444 KiB
#include <iostream>

using namespace std;

int main()
{
    int N;
    int db=0;
    int hossz;
    int maxszam=0;
    int maxindex;
    cin>>N;
    int szeletek[N];
    int dbszamok[N+1];
    for(int i=0;i<N;i++){
        cin>>szeletek[i];
        dbszamok[i+1]=0;
    }
    for(int i=0;i<N;i++){
        hossz=szeletek[i];
        dbszamok[hossz]++;
        db++;
        i=i+szeletek[i]-1;
    }
    cout<<db<<endl;
    for(int i=1;i<=N;i++){
        if(dbszamok[i]>maxszam){
            maxszam=dbszamok[i];
            maxindex=i;
        }
    }
    cout<<maxindex;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1756 KiB
2Accepted0/03ms1916 KiB
3Accepted4/43ms2124 KiB
4Accepted4/43ms2368 KiB
5Accepted4/43ms2548 KiB
6Accepted4/43ms2756 KiB
7Accepted4/42ms2844 KiB
8Accepted4/43ms3004 KiB
9Accepted4/43ms3080 KiB
10Accepted4/43ms3216 KiB
11Accepted4/43ms3464 KiB
12Accepted4/43ms3476 KiB
13Accepted4/44ms3752 KiB
14Accepted4/44ms4112 KiB
15Accepted4/46ms4128 KiB
16Accepted4/46ms4060 KiB
17Accepted4/413ms4544 KiB
18Accepted4/419ms5324 KiB
19Accepted4/426ms5424 KiB
20Accepted4/427ms5320 KiB
21Accepted4/435ms5428 KiB
22Accepted4/423ms5444 KiB