Submission #68911

#TimeUsernameProblemLanguageResultExecution timeMemory
68911mr_bananaRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
96 ms9684 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...