Submission #262167

#TimeUsernameProblemLanguageResultExecution timeMemory
262167stoyan_malininRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2085 ms8952 KiB
#include "railroad.h" //#include "grader.cpp" using namespace std; const long long inf = 1e18 + 5; int n; vector <int> s, t; long long memo[(1<<17)+5][20]; long long rec(int used, int usedCnt, int last) { if(usedCnt==n) return 0; long long answer = inf; for(int nxt = 0;nxt<n;nxt++) { if(((used>>nxt)&1)==1) continue; answer = min(answer, rec(used+(1<<nxt), usedCnt+1, nxt) + max(0, t[last]-s[nxt])); } return answer; } long long plan_roller_coaster(vector<int> _s, vector<int> _t) { s = _s; t = _t; n = s.size(); long long answer = inf; for(int first = 0;first<n;first++) answer = min(answer, rec((1<<first), 1, first)); return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...