이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/******************************************************************************
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |