Submission #77100

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

using namespace std;

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

int main()
{
    cin>>n ;
    for(int 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(int i = 0 ; i < n ; ++i)
    {
        long long MAX = vp[i].first , MIN = vp[i].first , sum = vp[i].second ;
        for(int 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 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -