70702023-12-29 11:22:05MagyarKendeSZLGBejgli (80 pont)cpp17Accepted 80/8013ms4780 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()

using namespace std;
using ll = long long;
using point = array<int, 2>;

int main() {
    speed;

    int N, count = 0, most = 0, most_s = 0;
    cin >> N;
    vector<int> B(N);
    cinv(B);

    map<int, int> m;
    for (int i = 0; i < N; count++) {
        m[B[i]]++;
        i += B[i];
    }
    for (auto [s, db] : m) {
        if (most < db) {
            most = db;
            most_s = s;
        }
    }

    cout << count << '\n' << most_s;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1828 KiB
2Accepted0/03ms2016 KiB
3Accepted4/43ms2232 KiB
4Accepted4/43ms2316 KiB
5Accepted4/43ms2548 KiB
6Accepted4/43ms2760 KiB
7Accepted4/43ms2980 KiB
8Accepted4/43ms3116 KiB
9Accepted4/43ms3332 KiB
10Accepted4/43ms3296 KiB
11Accepted4/43ms3404 KiB
12Accepted4/43ms3628 KiB
13Accepted4/43ms3584 KiB
14Accepted4/43ms3596 KiB
15Accepted4/44ms3836 KiB
16Accepted4/44ms3816 KiB
17Accepted4/47ms3912 KiB
18Accepted4/410ms4420 KiB
19Accepted4/412ms4420 KiB
20Accepted4/412ms4420 KiB
21Accepted4/413ms4544 KiB
22Accepted4/410ms4780 KiB