제출 #1026325

#제출 시각아이디문제언어결과실행 시간메모리
1026325vjudge1Roller Coaster Railroad (IOI16_railroad)C++17
34 / 100
39 ms10576 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; long long transit[20][20],dp[1<<16][16]; long long plan_roller_coaster(vector<int> s, vector<int> t) { int n = (int) s.size(); for(int i=0;i<n;i++) for(int j=0;j<n;j++) transit[i][j]=max(t[i]-s[j],0); memset(dp,7,sizeof dp); for(int i=0;i<n;i++) dp[1<<i][i]=0; for(int i=1;i<1<<n;i++) for(int j=0;j<n;j++) if(i&1<<j) for(int k=0;k<n;k++) if(~i&1<<k) dp[i|1<<k][k]=min(dp[i|1<<k][k],dp[i][j]+transit[j][k]); long long ans=1e18; for(int i=0;i<n;i++) ans=min(ans,dp[(1<<n)-1][i]); 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...