Submission #1112044

# Submission time Handle Problem Language Result Execution time Memory
1112044 2024-11-13T14:46:39 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;
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,si+pr});
    }
    sort(gh.begin(),gh.end(),sortu);
    for(i=0;i<n-1;i++){
        ma=max(ma,gh[i].second-(2*gh[i+1].first)+gh[i+1].second);
    }
    cout<<ma;
    

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