59872023-10-11 14:06:03hedizitaVállalkozócpp17Wrong answer 36/4067ms5080 KiB
#include <bits/stdc++.h>
using namespace std;
#define varazssor ios_base::sync_with_stdio(0); cin.tie(0);
using ll = long long;

//2.
int main(){
    varazssor;
    int n, m; cin >> n >> m;
    vector <int> rend(n); //nap
    vector <int> osszrend(m); //határidő
    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 < n; ++i){
        int vege = rend[i];
        for (int j = 0; j < m; ++j){
            if (osszrend[j] >= i + 1 && vege > 0){
                cnt++;
                vege--;
            }
            if (vege == 0){break;}
        }
    }
    cout << cnt << '\n';
}
SubtaskSumTestVerdictTimeMemory
base36/40
1Accepted0/03ms1828 KiB
2Accepted0/067ms2832 KiB
3Accepted2/23ms2228 KiB
4Accepted2/22ms2444 KiB
5Accepted2/22ms2524 KiB
6Wrong answer0/23ms2672 KiB
7Wrong answer0/24ms2932 KiB
8Accepted2/23ms2988 KiB
9Accepted2/24ms3336 KiB
10Accepted2/23ms3280 KiB
11Accepted2/23ms3508 KiB
12Accepted2/23ms3592 KiB
13Accepted2/24ms3868 KiB
14Accepted2/24ms3940 KiB
15Accepted2/29ms4036 KiB
16Accepted2/212ms4164 KiB
17Accepted2/27ms4196 KiB
18Accepted2/26ms4180 KiB
19Accepted2/27ms4180 KiB
20Accepted2/234ms4284 KiB
21Accepted2/246ms4728 KiB
22Accepted2/265ms5080 KiB