Submission #202934

# Submission time Handle Problem Language Result Execution time Memory
202934 2020-02-18T18:13:36 Z uzumix Art Exhibition (JOI18_art) C++14
0 / 100
5 ms 376 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);


    int n;

    vector<pair<long long,long long >> v;

    cin >> n;

    for(int i = 0 ; i < n ; i++)
    {

        long long a , b;

        cin >> a >> b;

        v.push_back({a,b});
    }


    sort(v.begin(),v.end());

    long long s = 0;

    long long aMin = 1e15 , aMax = -1;

    long long best = -1;

    for(int i = 0 ; i < n ; i++)
    {
        s+= v[i].second;

        aMin = min(v[i].first , aMin);

        aMax = max(v[i].first,aMax);

        best = max(best , s - (aMax- aMin));

    }

    cout << best;


    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -