This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
int nbVal,valTaille,valBenef,meilProp,rep,somBenef;
vector<pair<int,int>> val;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>nbVal;
for (int i=0;i<nbVal;i++) {
cin>>valTaille>>valBenef;
val.push_back({valTaille,valBenef});
}
sort(val.begin(),val.end());
for (int i=0;i<nbVal;i++) {
meilProp=max(meilProp,val[i].first-somBenef);
somBenef+=val[i].second;
rep=max(rep,somBenef+meilProp-val[i].first);
}
cout<<rep<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |