답안 #127236

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127236 2019-07-09T07:19:07 Z iqvocuc Art Exhibition (JOI18_art) C++14
10 / 100
3 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
pair<long long,int>v[100005];
const long long inf = -(long long)1e18 ;
int main(){
long long n,x,y;
long long tong1=inf,tong2=inf;
cin>>n;
for(long long i=1;i<=n;i++){
	cin>>v[i].first>>v[i].second;
}
	sort(v+1,v+n+1);
for(long long i=1;i<=n;i++){
	v[i].second+=v[i-1].second;
}
for(long long i=1;i<=n;i++){
   tong1 = max(tong1, v[i].first - v[i - 1].second);
   tong2 = max(tong2, v[i].second - v[i].first + tong1);
}
cout<<tong2;
}

Compilation message

art.cpp: In function 'int main()':
art.cpp:6:13: warning: unused variable 'x' [-Wunused-variable]
 long long n,x,y;
             ^
art.cpp:6:15: warning: unused variable 'y' [-Wunused-variable]
 long long n,x,y;
               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Incorrect 3 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Incorrect 3 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 252 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Incorrect 3 ms 376 KB Output isn't correct
13 Halted 0 ms 0 KB -