39812023-03-07 13:04:50nagytamasBejgli (80 pont)cpp17Wrong answer 70/8034ms5572 KiB
// bejgli.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <climits>

using namespace std;

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

int main()
{
    cin >> n;
    x.resize(n + 1);
    v.resize(n + 1);
    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
    }
    for (i = 1; i <= n; ++i)
    {
        sz = x[i - 1];
        if (i == 1)
        {
            m = x[i];
            --m;
            if (m == 0) ++db;
        }
        else if (m == 0)
        {
            ++v[sz];
            ++db;
            m = x[i];
            --m;
        }
        else
        {
            --m;
        }
    }
    if (m == 0) ++db;
    cout << db << "\n";
    maxi = INT_MIN;
    for (i = 1; i <= v.size() - 1; ++i)
    {
        if (v[i] > maxi)
        {
            maxi = v[i];
            p = i;
        }
    }
    cout << p;
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base70/80
1Wrong answer0/03ms1876 KiB
2Accepted0/03ms2072 KiB
3Accepted4/43ms2536 KiB
4Accepted4/43ms2712 KiB
5Accepted4/42ms2752 KiB
6Partially correct2/43ms2868 KiB
7Partially correct2/43ms3048 KiB
8Partially correct2/43ms3192 KiB
9Accepted4/43ms3276 KiB
10Partially correct2/43ms3416 KiB
11Accepted4/43ms3636 KiB
12Accepted4/43ms3732 KiB
13Accepted4/44ms3752 KiB
14Accepted4/44ms3832 KiB
15Accepted4/46ms4128 KiB
16Accepted4/46ms4528 KiB
17Accepted4/413ms4708 KiB
18Partially correct2/419ms5464 KiB
19Accepted4/427ms5452 KiB
20Accepted4/427ms5572 KiB
21Accepted4/434ms5572 KiB
22Accepted4/421ms5552 KiB