39802023-03-07 12:59:34nagytamasBejgli (80 pont)cpp17Wrong answer 52/8032ms5724 KiB
#include <iostream>
#include <vector>
#include <climits>

using namespace std;

int n, i, m, db,maxi,p;
vector <int> x,meg;

int main()
{
    cin >> n;
    x.resize(n + 1);
    meg.resize(n + 1);
    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }
    for (i = 1; i <= n; ++i)
    {
        if (i == 1)
        {
            m = x[1];
            --m;
            if (m == 0)
            {
                ++meg[1];
                ++db;
                m = x[i];
            }
        }
        else
        {
            --m;
            if (m == 0)
            {
                ++meg[x[i]];
                ++db;
                m = x[i];
            }
        }
    }
    cout << db << "\n";
    maxi = INT_MIN;
    for (i = 1; i <= n; ++i)
    {
        if (meg[i] > maxi)
        {
            maxi = meg[i];
            p = i;
        }
    }
    cout << p;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base52/80
1Accepted0/03ms1872 KiB
2Wrong answer0/02ms2068 KiB
3Partially correct2/42ms2276 KiB
4Partially correct2/42ms2364 KiB
5Partially correct2/42ms2492 KiB
6Accepted4/42ms2600 KiB
7Accepted4/43ms2800 KiB
8Accepted4/43ms3208 KiB
9Partially correct2/43ms3220 KiB
10Accepted4/43ms3332 KiB
11Partially correct2/43ms3352 KiB
12Partially correct2/43ms3584 KiB
13Partially correct2/44ms3548 KiB
14Partially correct2/44ms3568 KiB
15Partially correct2/46ms3608 KiB
16Partially correct2/46ms3740 KiB
17Partially correct2/413ms4356 KiB
18Accepted4/419ms5216 KiB
19Partially correct2/426ms5304 KiB
20Partially correct2/427ms5424 KiB
21Accepted4/432ms5636 KiB
22Partially correct2/421ms5724 KiB