#include <bits/stdc++.h>
using namespace std;
#define s second
#define ll long long
#define MAX 60 * 10000
void solve() {
ll n;
cin >> n;
vector <pair<ll,ll>> b(n);
for (ll i = 0; i < n; i++) {
cin >> b[i].first >> b[i].second;
} sort (b.begin(),b.end());
vector <ll> pref(n + 1);
pref[0] = 0;
for (ll i = 1; i <= n; i++) {
pref[i] = pref[i - 1] + b[i - 1].second;
}
ll max1 = INT_MIN;
for (ll l = 0; l < n; l++) {
for (ll r = l + 1; r < n; r++) {
max1 = max(max1,(pref[r + 1] - pref[l]) - (b[r].first - b[l].first));
}
} cout << max1;
}
int main()
{
solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |