제출 #1272544

#제출 시각아이디문제언어결과실행 시간메모리
1272544marshziinTopical (NOI23_topical)C++20
21 / 100
218 ms15944 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pii pair<int,int>


int32_t main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n, k; cin >> n >> k;
    if(k != 1) return 0;
    vector<pii> r(n + 1);
    for (int i = 1; i <= n; i++) 
        cin >> r[i].first ;
    for (int i = 1; i <= n; i++)
        cin >> r[i].second;
    sort(r.begin(), r.end());
    int ka = 0;
    int res = 0;
    for (int i = 1; i <= n; i++) {
        if(ka >= r[i].first) {
            ka += r[i].second;
            res++;
        }
        else break;
    }

    cout << res << '\n';
    return 0;   
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...