#include <bits/stdc++.h>
#define int long long
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout)
const int N=1e5+1;
const int inf=1e18;
const int mod=1e9+7;
using namespace std;
int n;
struct edge{
int ans,mx,mn,sum;
};
vector<edge>v1;
vector<pair<int,int> >v;
signed main(){
boost;
int n;
cin>>n;
for(int i=0;i<n;i++){
int x,y;
cin>>x>>y;
v.push_back({x,y});
}
sort(v.begin(),v.end());
int ans=0;
for(int i=0;i<=0;i++){
int sum=0;
for(int j=i;j<n;j++){
sum+=v[j].second;
ans=max(ans,sum-(v[j].first-v[i].first));
}
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |