Submission #996179

# Submission time Handle Problem Language Result Execution time Memory
996179 2024-06-10T08:30:28 Z imarn Art Exhibition (JOI18_art) C++14
0 / 100
1 ms 600 KB
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;cin>>n;
    ll ans=LLONG_MIN;pll x[2*n+1];x[0]={0,0};
    for(int i=1;i<=n;i++)cin>>x[i].f>>x[i].s;
    sort(x+1,x+n+1);for(int i=1;i<=n;i++)x[i].s=x[i-1].s+x[i].s;
    int l=1;
    for(int r=1;r<=n;r++){
        ans=max(ans,x[r].s-x[l-1].s-(x[r].f-x[l].f));
        if(-x[r-1].s+x[r].f>-x[l-1].s+x[l].f){l=r;}
    }cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -