#include <bits/stdc++.h>
#define zet ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define ll long long
#define pii pair<int, int>
using namespace std;
//const ll NN = 1e18+7;
//const int N = 1e5+15;
//pair<int, int> p[N];
//int a[N], sqr;
int main () {
ll n; cin >> n;
pii a[n];
for(ll i = 0; i < n; i++)cin >> a[i].first >> a[i].second;
sort(a + 1, a + n + 1);
ll mx = a[0].second,x = a[0].second;
for(ll i = 1; i < n; i++){
x += a[i].second;
x -= (a[i].first - a[i-1].first);
if(x < a[i].second)x = a[i].second;
mx = max(mx,x);
}
cout<<mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |