#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n; cin>>n;
vector<pair<ll,ll>> art(n);
for (int i=0; i<n; i++) {
cin>>art[i].first>>art[i].second;
}
sort(art.begin(), art.end());
vector<ll> pf(n);
pf[0]=art[0].second;
for (int i=1; i<n; i++) {
pf[i]=pf[i-1]+art[i].second;
}
ll ans=0;
for (int i=0; i<n; i++) {
for (int j=i+1; j<n; j++) {
ll k;
if (i==0) k=0ll;
else k=pf[i-1];
ans=max(ans, pf[j]-k-(art[j].first-art[i].first));
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |