Submission #114590

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1145902019-06-02 00:36:54wilwxkRoller Coaster Railroad (IOI16_railroad)C++11
34 / 100
369 ms335136 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...