Submission #103426

# Submission time Handle Problem Language Result Execution time Memory
103426 2019-03-30T15:35:11 Z Alliance Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 384 KB
// In the name of Allah. Ya ali!
#include<bits/stdc++.h>
#define double long double
typedef long long ll;
const ll MAX_N = 5e5+10;
const ll MOD = 1e9+7;
using namespace std;

pair<ll,ll> ab[MAX_N];
ll sum[MAX_N];
ll ans,n;

int main()
{
    ans = -1e18;
    cin >> n;
    for(int i = 1;i<=n;++i)
        cin >> ab[i].first >> ab[i].second;
    sort(ab+1,ab+n+1);
    for(int i = 1;i<=n;++i)
        sum[i] = sum[i-1]+ab[i].second;
    for(int i = 1;i<=n;++i)
    {
        for(int j = i+1;j<=n;++j)
        {
            ans = max(ans,sum[j]-sum[i-1]-ab[j].first+ab[i].first);
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -