| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1314102 | activedeltorre | Roller Coaster Railroad (IOI16_railroad) | C++20 | 29 ms | 9636 KiB |
#include "railroad.h"
long long dp[70000][18];
using namespace std;
#include<vector>
#include<iostream>
long long vmax=1e12;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = (int) s.size();
if(n<=16)
{
int maxmask=(1<<n)-1;
for(int i=0;i<=maxmask;i++)
{
for(int j=0;j<n;j++)
{
dp[i][j]=vmax;
}
}
for(int i=0;i<n;i++)
{
dp[(1<<i)][i]=0;
}
for(int i=1;i<maxmask;i++)
{
for(int last=0;last<n;last++)
{
if(((1<<last)&i)!=0)
{
for(int j=0;j<n;j++)
{
if(((1<<j)&i)==0)
{
long long cost=max(0,t[last]-s[j]);
dp[i^(1<<j)][j]=min(dp[i^(1<<j)][j],dp[i][last]+cost);
}
}
}
}
}
long long best=vmax;
for(int last=0;last<n;last++)
{
best=min(best,dp[maxmask][last]);
}
return best;
}
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... | ||||
