59272023-10-05 19:35:43rennVállalkozócpp17Wrong answer 4/4010ms3756 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(0);

    int N, M, jo = 0;
    cin >> N >> M;
    vector<int> napok(N);
    vector<int> munkak(N+1, 0);

    for(int &x : napok) cin >> x;

    for(int i = 0, j; i < M; i++)
    {
        cin >> j;
        munkak[j-1]++;
    }
    
    for(int i = 0; i < N; i++)
    {
        jo += min(napok[i], munkak[i]);
        napok[i+1] += napok[i]-munkak[i];
    }

    cout << jo << "\n";

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/03ms1832 KiB
2Wrong answer0/010ms2064 KiB
3Accepted2/23ms2260 KiB
4Accepted2/22ms2316 KiB
5Wrong answer0/22ms2340 KiB
6Wrong answer0/23ms2560 KiB
7Wrong answer0/23ms2640 KiB
8Runtime error0/23ms2872 KiB
9Wrong answer0/23ms2844 KiB
10Wrong answer0/23ms3088 KiB
11Wrong answer0/23ms2956 KiB
12Runtime error0/23ms3024 KiB
13Wrong answer0/23ms3052 KiB
14Runtime error0/23ms3244 KiB
15Wrong answer0/24ms3132 KiB
16Wrong answer0/24ms3132 KiB
17Wrong answer0/27ms3472 KiB
18Wrong answer0/24ms3484 KiB
19Wrong answer0/26ms3756 KiB
20Wrong answer0/27ms3504 KiB
21Wrong answer0/28ms3504 KiB
22Wrong answer0/210ms3504 KiB