Submission #1108445

# Submission time Handle Problem Language Result Execution time Memory
1108445 2024-11-04T07:03:08 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 336 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n,s,d,ans;
pair<ll,ll>a[500005];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].first>>a[i].second;
    sort(a+1,a+n+1);
    d=-a[1].first;
    ans=-1e18;
    for(int i=1;i<=n;i++)
    {
        s+=a[i].second;
        ans=max(ans,s-a[i].first-d);
        d=min(d,s-a[i].second-a[i].first);
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -