Submission #77101

# Submission time Handle Problem Language Result Execution time Memory
77101 2018-09-21T11:27:27 Z MohamedAhmed0 Art Exhibition (JOI18_art) C++14
0 / 100
2 ms 256 KB
#include <bits/stdc++.h>

using namespace std;

long long n ;
vector< pair<long long , long long> >vp ;

int main()
{
    cin>>n ;
    for(long long i = 0 ; i < n ; ++i)
    {
        long long x , y ;
        cin>>x>>y ;
        vp.push_back({x , y});
    }
    sort(vp.begin() , vp.end());
    long long ans = 0 ;
    for(long long i = 0 ; i < n ; ++i)
    {
        long long MAX = vp[i].first , MIN = vp[i].first , sum = vp[i].second ;
        for(long long j = i+1 ; j < n ; ++j)
        {
            MAX = max(MAX , vp[j].first * 1ll);
            MIN = min(MIN , vp[j].first * 1ll);
            sum += vp[j].second * 1ll;
            ans = max(ans , sum - MAX + MIN) * 1ll;
        }
    }
    return cout<<ans , 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -