58702023-10-04 17:32:51EsVagyVállalkozócpp17Elfogadva 40/4026ms3988 KiB
// Vallakozo.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
using namespace std;

int main()
{
    int days, tasks;
    cin >> days >> tasks;
    vector<int> availability;
    for (int i = 0; i < days; i++)
    {
        int val;
        cin >> val;
        availability.push_back(val);
    }
    for (int i = 0; i < tasks; i++)
    {
        int day;
        cin >> day;
        day -= 1;
        availability[day]--;
    }
    int ans = tasks;
    for (int i = 0; i < days; i++)
    {
        if (availability[i] < 0)
        {
            ans += availability[i];
        }
        else
        {
            if (i + 1 < availability.size())
            {
                availability[i + 1] += availability[i];
            }
        }
    }
    cout << ans;

}

// 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/40
1Elfogadva0/03ms1812 KiB
2Elfogadva0/026ms2064 KiB
3Elfogadva2/23ms2292 KiB
4Elfogadva2/23ms2492 KiB
5Elfogadva2/23ms2696 KiB
6Elfogadva2/23ms2884 KiB
7Elfogadva2/24ms3100 KiB
8Elfogadva2/23ms3276 KiB
9Elfogadva2/24ms3360 KiB
10Elfogadva2/23ms3492 KiB
11Elfogadva2/23ms3600 KiB
12Elfogadva2/23ms3724 KiB
13Elfogadva2/24ms3816 KiB
14Elfogadva2/24ms3784 KiB
15Elfogadva2/28ms3808 KiB
16Elfogadva2/29ms3888 KiB
17Elfogadva2/214ms3988 KiB
18Elfogadva2/210ms3988 KiB
19Elfogadva2/213ms3984 KiB
20Elfogadva2/214ms3908 KiB
21Elfogadva2/218ms3892 KiB
22Elfogadva2/226ms3892 KiB