59862023-10-11 13:53:38hedizitaVállalkozócpp17Time limit exceeded 34/40200ms4328 KiB
#include <bits/stdc++.h>
using namespace std;
#define varazssor ios_base::sync_with_stdio(0); cin.tie(0);
using ll = long long;


//3.

int main(){
    varazssor;
    int n, m; cin >> n >> m;
    vector<int> rend(n);
    vector<int> osszrend(m);

    for(int i = 0; i < n; ++i){
        cin >> rend[i];
    }

    for(int i = 0; i < m; ++i){
        cin >> osszrend[i];
    }

    sort(osszrend.begin(), osszrend.end());
    int cnt = 0;

    for(int i = 0; i < m; ++i){
        int vege = osszrend[i];

        for(int i = vege-1; i >= 0; --i){
            if(rend[i] > 0){
                cnt++;
                rend[i]--;
                break;
            }
        }
    }
    cout << cnt << '\n';
}

SubtaskSumTestVerdictTimeMemory
base34/40
1Accepted0/03ms1700 KiB
2Accepted0/064ms2740 KiB
3Accepted2/23ms2140 KiB
4Accepted2/23ms2372 KiB
5Accepted2/23ms2508 KiB
6Accepted2/23ms2616 KiB
7Accepted2/24ms2620 KiB
8Accepted2/23ms2612 KiB
9Accepted2/23ms2612 KiB
10Accepted2/23ms2596 KiB
11Accepted2/23ms2948 KiB
12Accepted2/23ms2816 KiB
13Accepted2/24ms2832 KiB
14Accepted2/24ms3076 KiB
15Accepted2/29ms3260 KiB
16Accepted2/212ms3396 KiB
17Time limit exceeded0/2200ms2572 KiB
18Time limit exceeded0/2160ms2632 KiB
19Time limit exceeded0/2160ms2652 KiB
20Accepted2/232ms3568 KiB
21Accepted2/245ms3632 KiB
22Accepted2/264ms4328 KiB