#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;
pair<ll, ll> 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |