#include<bits/stdc++.h>
#define mp make_pair
using namespace std;
vector<pair<long long,long long> > v;
int main(){
int n;
long long cur=0;
cin>>n;
for(int i=0;i<n;i++){
long long a,b;
cin>>a >>b;
v.push_back(mp(a,b));
}
long long ans=LLONG_MIN;
sort(v.begin(),v.end());
for(int i=0;i<n;i++){
if(i) cur-=v[i].first-v[i-1].first;
cur+=v[i].second;
if(cur<0) cur=v[i].second;
ans=max(ans,cur);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |