75912024-01-09 22:23:52CsongiBejgli (80 pont)cpp14Accepted 80/8041ms8232 KiB
#include <iostream>
#include <bits/stdc++.h>
#include <vector>

using namespace std;

int index(map<int, int> map)
{
    int legn = 0;
    int ind = 0;
    for (int i = 0; i < map.size(); i++)
    {
        if (map[i] > legn) {
            legn = map[i];
            ind = i;
        }
    }
    return ind;
}

int main()
{
    int n;
    cin >> n;
    vector<int> bejgli(0);
    int m;
    vector<int> bejglinagy(n);
    for (int i = 0; i < n; i++)
    {
        cin >> m;
        bejglinagy[i] = m;
    }
    for (int i = 0; i < n; i += bejglinagy[i])
    {
        bejgli.push_back(bejglinagy[i]);
    }
    // 2n < n**2
    cout << bejgli.size() << endl;
    map<int, int> sok;
    for (auto i: bejgli)
    {
        ++sok[i];
    }
    cout << index(sok);
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1816 KiB
2Accepted0/03ms2060 KiB
3Accepted4/43ms2268 KiB
4Accepted4/43ms2492 KiB
5Accepted4/43ms2600 KiB
6Accepted4/43ms2788 KiB
7Accepted4/43ms3016 KiB
8Accepted4/43ms2860 KiB
9Accepted4/43ms3204 KiB
10Accepted4/43ms3232 KiB
11Accepted4/43ms3372 KiB
12Accepted4/44ms3624 KiB
13Accepted4/44ms3932 KiB
14Accepted4/44ms4164 KiB
15Accepted4/46ms4128 KiB
16Accepted4/46ms4048 KiB
17Accepted4/413ms4172 KiB
18Accepted4/420ms5816 KiB
19Accepted4/426ms4844 KiB
20Accepted4/427ms4928 KiB
21Accepted4/441ms8232 KiB
22Accepted4/423ms5188 KiB