| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 119162 | someone_aa | Roller Coaster Railroad (IOI16_railroad) | C++17 | 65 ms | 10652 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "railroad.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 17;
ll dp[maxn][(1<<maxn)], n;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
n = (int) s.size();
for(int i=1;i<(1<<n);i++) {
//cout<<i<<": \n";
for(int c=0;c<n;c++) {
if(!((1<<c)&i)) continue;
dp[c][i] = LLONG_MAX;
if(__builtin_popcount(i) == 1) {
dp[c][i] = 0;
}
else {
for(int p=0;p<n;p++) {
if(!((1<<p)&i) || c == p) continue;
ll cost = max(0LL, 1LL * t[p] - s[c]);
dp[c][i] = min(dp[c][i], dp[p][(i^(1<<c))] + cost);
}
}
//cout<<c<<" - "<<dp[c][i]<<"\n";
}
}
ll result = LLONG_MAX;
for(int i=0;i<n;i++) {
result = min(result, dp[i][(1<<n)-1]);
}
return result;
}| # | 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... | ||||
