답안 #134776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
134776 2019-07-23T09:12:05 Z ckodser Shortcut (IOI16_shortcut) C++14
0 / 100
2 ms 504 KB
#include "shortcut.h"
#include<bits/stdc++.h>

#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<ll,ll>
#define F first
#define S second
#define ld long double

using namespace :: std;
const ll maxn=1e5+500;
const ll inf=1e17+900;

ll pos[maxn];
ll farr[maxn];
ll farl[maxn];
ll dr[maxn];
ll dl[maxn];

long long find_shortcut(int n,vector<int> l,vector<int> d, int c)
{
    pos[0]=0;
    for(ll i=1;i<n;i++){
	pos[i]=pos[i-1]+l[i-1];
    }
    dl[0]=0;
    farl[0]=d[0];
    for(ll i=1;i<n;i++){
	farl[i]=max((ll)d[i],farl[i-1]+l[i-1]);
	dl[i]=max(dl[i-1],farl[i-1]+l[i-1]+d[i]);
    }
    dr[n-1]=0;
    farr[n-1]=d[n-1];
    for(ll i=n-2;i>=0;i--){
    	farr[i]=max((ll)d[i],farr[i+1]+l[i]);
	dr[i]=max(dr[i+1],farr[i+1]+l[i]+d[i]);
    }
    ll ans=dr[0];
    for(ll i=0;i<n;i++){
	for(ll j=i+1;j<n;j++){
	    ll res=max(dr[j],dl[i]);
	    ll sdi=d[i];
	    ll sdj=d[j];
	    d[j]=farr[j];
	    d[i]=farl[i];
	    ll tol=c+pos[j]-pos[i];
	    
	    for(ll u=i;u<=j;u++){
		for(ll v=u+1;v<=j;v++){
		    res=max(res,d[v]+d[u]+min(pos[v]-pos[u],tol-(pos[v]-pos[u])));
		}
	    }
	    ans=min(ans,res);


	    d[j]=sdj;
	    d[i]=sdi;
	}
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB n = 4, 80 is a correct answer
2 Correct 2 ms 380 KB n = 9, 110 is a correct answer
3 Correct 2 ms 376 KB n = 4, 21 is a correct answer
4 Correct 2 ms 376 KB n = 3, 4 is a correct answer
5 Correct 2 ms 376 KB n = 2, 62 is a correct answer
6 Correct 2 ms 376 KB n = 2, 3 is a correct answer
7 Correct 2 ms 376 KB n = 3, 29 is a correct answer
8 Correct 2 ms 376 KB n = 2, 3 is a correct answer
9 Correct 2 ms 376 KB n = 2, 3 is a correct answer
10 Correct 2 ms 504 KB n = 2, 2000000001 is a correct answer
11 Correct 2 ms 376 KB n = 2, 3000000000 is a correct answer
12 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
13 Correct 2 ms 376 KB n = 3, 3000000000 is a correct answer
14 Incorrect 2 ms 380 KB n = 4, incorrect answer: jury 3000000001 vs contestant 3000000000
15 Halted 0 ms 0 KB -