Submission #838644

#TimeUsernameProblemLanguageResultExecution timeMemory
838644oscar1fArt Exhibition (JOI18_art)C++17
100 / 100
146 ms21036 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...