# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
79985 | Genezio | Art Exhibition (JOI18_art) | C++14 | 321 ms | 254888 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 500010;
#define ll long long int
#define F first
#define S second
pair<ll,ll> v[N];
ll dp[N][2];
int n;
ll f(int x,int y) {
if(dp[x][y]>=0) return dp[x][y];
ll aux = v[x].S-v[x].F+v[x-1].F;
if(y) {
if(x==n) return aux;
return dp[x][y]=max(aux,aux+f(x+1,y));
} else {
if(x==n) return v[x].S;
return dp[x][y]=max({v[x].S,f(x+1,y),v[x].S+f(x+1,y+1)});
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(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... |