# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
136265 | KLPP | Art Exhibition (JOI18_art) | C++14 | 278 ms | 24684 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef pair<lld,lld> pii;
#define rep(i,a,b) for(int i=a;i<b;i++)
int main(){
int n;
scanf("%d",&n);
pii arr[n];
rep(i,0,n){
scanf("%lld %lld",&arr[i].first,&arr[i].second);
}
sort(arr,arr+n);
lld DP[n];
DP[0]=arr[0].second;
rep(i,1,n){
DP[i]=arr[i].second;
DP[i]=max(DP[i],DP[i-1]+arr[i].second-(arr[i].first-arr[i-1].first));
}
lld ans=0;
rep(i,0,n)ans=max(ans,DP[i]);
printf("%lld\n",ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |