이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "railroad.h"
#include<bits/stdc++.h>
const int MN=16+1;
const long long inf=1e18;
long long dp[1<<MN][MN];
using namespace std;
long long plan_roller_coaster(vector<int> s, vector<int> t) {
int n = (int) s.size();
long long ans=inf;
for(int i=0;i<(1<<n);i++){
for(int j=0;j<n;j++){
dp[i][j]=inf;
if((i^(1<<j))==0)
{
dp[i][j]=0;
}
for(int k=0;k<n;k++){
if((i&(1<<j)) && (i&(1<<k)) && j!=k){
dp[i][j]=min(dp[i][j],dp[i^(1<<j)][k]+max(0,t[k]-s[j]));
}
}
if(i==((1<<n)-1)){
ans=min(ans,dp[i][j]);
}
}
}
return ans;
}
| # | 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... |