58742023-10-04 17:39:37gergomiszoriVállalkozócpp11Time limit exceeded 10/40200ms4396 KiB
#include <bits/stdc++.h>

using namespace std;

int n, m;
int elv;

vector<int> mo, hi;

int main()
{
    cin >> n >> m;

    mo.resize(n);
    hi.resize(m);

    for(int i = 0; i < n; i++) cin >> mo[i];
    for(int i = 0; i < m; i++) cin >> hi[i];

    sort(hi.begin(), hi.end());

    for(int i = 1; i < n; i++)
    {
        while(!hi.empty() && hi[0] < i)
            hi.erase(hi.begin());
        for(int j = 0; j < mo[i]; j++)
        {
            if(hi.empty())
                break;
            hi.erase(hi.begin());
            elv++;
        }
        if(hi.empty())
            break;
    }

    cout << elv;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base10/40
1Accepted0/03ms1872 KiB
2Time limit exceeded0/0200ms1608 KiB
3Wrong answer0/22ms2196 KiB
4Accepted2/22ms2384 KiB
5Wrong answer0/23ms2616 KiB
6Wrong answer0/24ms2880 KiB
7Wrong answer0/24ms3220 KiB
8Wrong answer0/23ms3240 KiB
9Wrong answer0/24ms3260 KiB
10Wrong answer0/23ms3724 KiB
11Wrong answer0/24ms3720 KiB
12Wrong answer0/24ms3756 KiB
13Accepted2/26ms3772 KiB
14Wrong answer0/24ms3888 KiB
15Wrong answer0/261ms4236 KiB
16Wrong answer0/257ms4396 KiB
17Accepted2/286ms4224 KiB
18Accepted2/237ms4344 KiB
19Accepted2/259ms4324 KiB
20Wrong answer0/2150ms4312 KiB
21Time limit exceeded0/2181ms3624 KiB
22Time limit exceeded0/2168ms3720 KiB