제출 #77103

#제출 시각아이디문제언어결과실행 시간메모리
77103MohamedAhmed0Art Exhibition (JOI18_art)C++14
50 / 100
1078 ms8928 KiB
#include <bits/stdc++.h>

using namespace std;

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

int main()
{
    scanf("%lld" , &n);
    for(long long i = 0 ; i < n ; ++i)
    {
        long long x , y ;
        scanf("%lld %lld" , &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 = 0 , MIN = 1e18 , sum = 0 ;
        for(long long j = i ; j < n ; ++j)
        {
            MAX = max(MAX , vp[j].first);
            MIN = min(MIN , vp[j].first);
            sum += vp[j].second ;
            ans = max(ans , sum - (MAX - MIN)) ;
        }
    }
    return printf("%lld" , ans) , 0;
}

컴파일 시 표준 에러 (stderr) 메시지

art.cpp: In function 'int main()':
art.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld" , &n);
     ~~~~~^~~~~~~~~~~~~
art.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld" , &x , &y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...