Submission #1019618

#TimeUsernameProblemLanguageResultExecution timeMemory
1019618huutuanRoller Coaster Railroad (IOI16_railroad)C++14
34 / 100
35 ms13904 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define int long long long long plan_roller_coaster(vector<int32_t> s, vector<int32_t> t) { int n=(int)s.size(); vector<vector<int>> f(1<<n, vector<int>(n, 1e18)); for (int i=0; i<n; ++i) f[1<<i][i]=0; for (int i=0; i<(1<<n); ++i) for (int j=0; j<n; ++j) if (i>>j&1 && f[i][j]<1e18){ for (int k=0; k<n; ++k) if (!(i>>k&1)){ f[i|1<<k][k]=min(f[i|1<<k][k], f[i][j]+max(0, t[j]-s[k])); } } return *min_element(f[(1<<n)-1].begin(), f[(1<<n)-1].end()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...