58252023-10-02 22:02:21TuruTamasVállalkozócpp17Accepted 40/4032ms5480 KiB
#include "bits/stdc++.h"
#include <algorithm>
#include <vector>
using namespace std;

int N, M;
vector<int> telj;
vector<int> hata;

int main() {
    cin >> N >> M;
    telj.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> telj[i];
    }
    hata.resize(M);
    for (int i = 0; i < M; i++) {
        cin >> hata[i];
        hata[i]--;
    }
    sort(hata.begin(), hata.end());
    int t = 0, i = 0, r = 0;
    for (int h : hata) {
        if (i == telj[t]) {
            i = 0;
            t++;
            while (telj[t] == 0) t++;
        }
        if (h >= t) {
            i++;
            r++;
        }
    }
    cout << r << endl;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1872 KiB
2Accepted0/032ms2820 KiB
3Accepted2/23ms2488 KiB
4Accepted2/22ms2560 KiB
5Accepted2/22ms2768 KiB
6Accepted2/23ms3000 KiB
7Accepted2/24ms2864 KiB
8Accepted2/23ms2852 KiB
9Accepted2/24ms2860 KiB
10Accepted2/23ms3044 KiB
11Accepted2/24ms3280 KiB
12Accepted2/24ms3512 KiB
13Accepted2/24ms3896 KiB
14Accepted2/24ms3940 KiB
15Accepted2/210ms4236 KiB
16Accepted2/212ms4480 KiB
17Accepted2/216ms4632 KiB
18Accepted2/210ms4664 KiB
19Accepted2/213ms4824 KiB
20Accepted2/217ms4800 KiB
21Accepted2/224ms5080 KiB
22Accepted2/232ms5480 KiB