Submission #1093109

# Submission time Handle Problem Language Result Execution time Memory
1093109 2024-09-26T01:11:14 Z DucNguyen2007 Art Exhibition (JOI18_art) C++14
0 / 100
0 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
const int maxN=5e5+5;
const ll inf=2e18;
int n;
pll p[maxN+1];
int main()
{
    //freopen("","r",stdin);
    //freopen("","w",stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>p[i].fi>>p[i].se;
    }
    sort(p+1,p+n+1,[&](pll x,pll y)
    {
        if(x.fi==y.fi)
        {
            return x.se<y.se;
        }
        return x.fi<y.fi;
    });
    ll sum=0,ans=-inf;
    for(int i=1;i<=n;i++)
    {
        sum+=p[i].se;
        ans=max(ans,sum-(p[i].fi-p[1].fi));
    }
    cout<<ans;
}
# 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 -