# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
114590 | wilwxk | Roller Coaster Railroad (IOI16_railroad) | C++11 | 369 ms | 335136 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=20;
const ll INF=1e18;
ll dist[MAXN][MAXN];
ll dp[MAXN][(1<<MAXN)];
int n;
ll fazdp(int cur, int mask) {
if(dp[cur][mask]!=-1) return dp[cur][mask];
dp[cur][mask]=INF;
for(int viz=0; viz<n; viz++) {
if(viz==cur) continue;
if((mask&(1<<viz))==0) continue;
ll val=fazdp(viz, mask^(1<<cur))+dist[viz][cur];
dp[cur][mask]=min(dp[cur][mask], val);
}
// printf("%d %d >> %lld\n", cur, mask, dp[cur][mask]);
return dp[cur][mask];
}
ll plan_roller_coaster(vector<int> s, vector<int> t) {
n = (int) s.size();
memset(dp, -1, sizeof(dp));
for(int i=0; i<n; i++) dp[i][(1<<i)]=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... |