249832026-02-17 11:02:02KevinGladiátorok (40 pont)cpp17Runtime error 10/4067ms6712 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll, ll>;

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n, q; cin >> n >> q;
    vector<pll> ellenfel(n), hos(q);
    for (ll i=0; i<n; i++) cin >> ellenfel[i].first >> ellenfel[i].second;
    for (ll i=0; i<q; i++){
        cin >> hos[i].first;
        hos[i].second=i;
    }
    sort(ellenfel.begin(), ellenfel.end());
    sort(hos.begin(), hos.end());
    ll bonus=0;
    vector<ll> out(q, n);
    ll curr=0;
    for (ll i=0; i<n; i++){
        while (hos[curr].first+bonus<ellenfel[i].first){
            out[hos[curr].second]=i;
            curr++;
        }
        bonus+=ellenfel[i].second;
    }
    for (ll& z:out) cout << z << ' ';
}
SubtaskSumTestVerdictTimeMemory
base10/40
1Accepted0/01ms316 KiB
2Runtime error0/014ms1612 KiB
3Runtime error0/21ms316 KiB
4Runtime error0/21ms564 KiB
5Runtime error0/22ms564 KiB
6Runtime error0/23ms564 KiB
7Runtime error0/23ms564 KiB
8Runtime error0/23ms564 KiB
9Runtime error0/23ms564 KiB
10Runtime error0/23ms564 KiB
11Runtime error0/29ms1076 KiB
12Runtime error0/248ms4068 KiB
13Runtime error0/245ms4928 KiB
14Runtime error0/264ms6708 KiB
15Runtime error0/264ms6712 KiB
16Runtime error0/264ms6256 KiB
17Runtime error0/264ms6464 KiB
18Accepted2/263ms6452 KiB
19Accepted2/263ms6244 KiB
20Accepted2/264ms6184 KiB
21Accepted2/264ms5392 KiB
22Accepted2/267ms6452 KiB