48672023-04-03 16:00:59norbertvidaBejgli (80 pont)cpp17Accepted 80/8012ms4956 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {

    iostream::sync_with_stdio(0);
    cin.tie(0);

    int N;
    cin >> N;

    int *M = new int[N];
    for(int i = 0; i < N; i++) cin >> M[i];

    int szelet_db = 0;
    map<int, int> szelet_tipus_db;
    int max_darab_tipus = -1;

    for(int i = 0; i < N; i++) {
        szelet_db++;
        szelet_tipus_db[M[i]]++;
        if(szelet_tipus_db[max_darab_tipus] < szelet_tipus_db[M[i]]) {
            max_darab_tipus = M[i];
        }
        i += M[i] - 1;
    }

    cout << szelet_db << "\n" << max_darab_tipus << "\n";

}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1824 KiB
2Accepted0/03ms2056 KiB
3Accepted4/42ms2268 KiB
4Accepted4/43ms2464 KiB
5Accepted4/43ms2528 KiB
6Accepted4/43ms2932 KiB
7Accepted4/43ms2816 KiB
8Accepted4/43ms2916 KiB
9Accepted4/43ms3000 KiB
10Accepted4/43ms3244 KiB
11Accepted4/43ms3232 KiB
12Accepted4/43ms3364 KiB
13Accepted4/43ms3452 KiB
14Accepted4/43ms3720 KiB
15Accepted4/44ms3700 KiB
16Accepted4/44ms3716 KiB
17Accepted4/47ms3984 KiB
18Accepted4/410ms4448 KiB
19Accepted4/410ms4460 KiB
20Accepted4/410ms4516 KiB
21Accepted4/412ms4632 KiB
22Accepted4/49ms4956 KiB