답안 #1112070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112070 2024-11-13T15:58:51 Z vjudge1 Art Exhibition (JOI18_art) C++17
0 / 100
1 ms 336 KB
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;

long long n,si,pr,i,ma=-1e18,mal=-1e18,j;
vector<pair<long long,long long>> gh;

int sortu(pair<long long,long long> a,pair<long long,long long> b){
    if(a.first==b.first){
        return a.second<b.second;
    }
    return a.first<b.first;
}

int main()
{
    cin>>n;
    for(i=0;i<n;i++){
        cin>>si>>pr;
        gh.push_back({si,pr});
    }
    gh.push_back({0,0});
    sort(gh.begin(),gh.end(),sortu);
    for(i=1;i<n;i++){
        gh[i].second=gh[i-1].second+gh[i].second;
    }
    for(i=0;i<=n;i++){
        for(j=i;j<=n;j++){
            ma=max(ma,gh[j].second-gh[i].second-gh[j].first+gh[i].first);
        }
    }
    cout<<ma;
    

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Halted 0 ms 0 KB -