59202023-10-05 17:45:361478Vállalkozócpp17Hibás válasz 38/4034ms4804 KiB
#include <bits/stdc++.h>  
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(ll i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
int main()
{
    //ifstream cin("in.txt");
    int n;
    cin >> n;

    int m;
    cin >> m;

    vector<int> workTimes(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> workTimes[i];
    }

    vector<int> tasks(m + 1);
    for(int i = 1; i <= m; i++){
        cin >> tasks[i];
    }

    sort(tasks.begin() + 1, tasks.end());

    int ans = 0;
    int j = 1;

    for(int i = 1; i <= n; i++){

        while(j <= m && tasks[j] < i){
            j++;
            ans++;
        }
        while(workTimes[i] && j <= m && tasks[j] >= i){
            j++;
            workTimes[i]--;
        }
    }

    cout << m - ans;

}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base38/40
1Elfogadva0/03ms1812 KiB
2Elfogadva0/034ms2760 KiB
3Hibás válasz0/22ms2284 KiB
4Elfogadva2/23ms2480 KiB
5Elfogadva2/22ms2568 KiB
6Elfogadva2/24ms2816 KiB
7Elfogadva2/24ms2984 KiB
8Elfogadva2/23ms3088 KiB
9Elfogadva2/24ms3296 KiB
10Elfogadva2/23ms3256 KiB
11Elfogadva2/24ms3268 KiB
12Elfogadva2/23ms3264 KiB
13Elfogadva2/24ms3276 KiB
14Elfogadva2/24ms3668 KiB
15Elfogadva2/210ms4108 KiB
16Elfogadva2/212ms4316 KiB
17Elfogadva2/214ms4200 KiB
18Elfogadva2/210ms4292 KiB
19Elfogadva2/213ms4428 KiB
20Elfogadva2/217ms4416 KiB
21Elfogadva2/225ms4500 KiB
22Elfogadva2/234ms4804 KiB