#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY 100000000000005
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 300005
#define fi first
#define se second
vector<pair<int,int>> dizi;
int32_t main(){
faster
int n;cin>>n;
dizi.push_back({-LLONG_MAX,-LLONG_MAX});
FOR{
int x,y;cin>>x>>y;
dizi.push_back({x,y});
}
sort(dizi.begin(),dizi.end());
int mini_bir=LLONG_MAX,cev=-LLONG_MAX,sum=0;
FOR{
mini_bir=min(mini_bir,dizi[i].fi);
//cout<<sum<<" "<<mini_bir<<" "<<cev<<" "<<sum-(dizi[i].fi-mini_bir)<<endl;
//cev=max(cev,sum-(dizi[i].fi-mini_bir));
if(sum-(dizi[i].fi-mini_bir)>0){
//cev=max(cev,sum-(dizi[i].fi-mini_bir));
}
else{
mini_bir=dizi[i].fi;
}
sum+=dizi[i].se;
cev=max(cev,sum-(dizi[i].fi-mini_bir));
}
cout<<cev<<endl;
return 0;
}
# |
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 |
- |