61322023-11-03 00:21:38horvathabelGladiátorok (40 pont)cpp17Wrong answer 0/40356ms15380 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
bool r(pair<ll,ll> a, pair<ll,ll> b){
    if (a.first==b.first) return(a.second>b.second);
    return (a.first<b.first);
}
int main()
{
    int n,m;
    cin>>n>>m;
    vector<pair<ll,ll>> s;
    vector<ll> b;
    for (int i=0; i<n;i++){
        int a,b;
        cin>>a>>b;
        s.push_back({a,b});
    }
    sort(s.begin(),s.end(),r);
    int kv=s[0].second;
    vector<ll> p={s[0].second};
    for (int i=1;i<n;i++){
        p.push_back(max(s[i].first-kv,p[i-1]));
        kv+=s[i].second;
    }
    for (int x:p) cout<<x<<" ";
    int ans;
    for (int i=0;i<n;i++){
        ll x;
        cin>>x;
        cout<<lower_bound(p.begin(),p.end(),x)-p.begin()<<" ";
    }


}
SubtaskSumTestVerdictTimeMemory
base0/40
1Wrong answer0/03ms1684 KiB
2Wrong answer0/052ms3744 KiB
3Wrong answer0/23ms2224 KiB
4Wrong answer0/23ms2412 KiB
5Wrong answer0/28ms3004 KiB
6Wrong answer0/212ms2960 KiB
7Wrong answer0/210ms3048 KiB
8Wrong answer0/28ms3176 KiB
9Wrong answer0/213ms3416 KiB
10Wrong answer0/212ms3496 KiB
11Wrong answer0/239ms4844 KiB
12Wrong answer0/2231ms10316 KiB
13Wrong answer0/2172ms7488 KiB
14Wrong answer0/2356ms11692 KiB
15Wrong answer0/2273ms12432 KiB
16Wrong answer0/2351ms13200 KiB
17Wrong answer0/2273ms13760 KiB
18Wrong answer0/2226ms14172 KiB
19Wrong answer0/2305ms14380 KiB
20Wrong answer0/2231ms14660 KiB
21Wrong answer0/2316ms15060 KiB
22Wrong answer0/2312ms15380 KiB