Submission #758886

#TimeUsernameProblemLanguageResultExecution timeMemory
758886Dan4LifeRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
45 ms23380 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; ll D[1<<16][16]; ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); memset(D,63,sizeof(D)); for(int i = 0; i < n; i++) D[1<<i][i]=0; for(int m = 1; m < (1<<n); m++) for(int i = 0; i < n; i++) if(m>>i&1) for(int j = 0; j < n; j++) if(m>>j&1 and j!=i) D[m][i] = min(D[m][i], D[m^1<<i][j]+(ll)max(0,t[j]-s[i])); return *min_element(D[(1<<n)-1],D[(1<<n)-1]+n); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...