Submission #100002

#TimeUsernameProblemLanguageResultExecution timeMemory
100002shenxyRoller Coaster Railroad (IOI16_railroad)C++11
11 / 100
70 ms3496 KiB
#include "railroad.h" #include <algorithm> #include <vector> #define INF 1E18 using namespace std; int N; long long int plan_roller_coaster(vector<int> s, vector<int> t) { N = s.size(); if (N <= 8) { vector<int> u; for (int i = 0; i < 8; i++) { u.push_back(i); } long long int ans = 0; for (int i = 1; i < 8; i++) { ans += max(0, t[u[i - 1]] - s[u[i]]); } while (next_permutation(u.begin(), u.end())) { long long int temp = 0; for (int i = 1; i < 8; i++) { temp += max(0, t[u[i - 1]] - s[u[i]]); } ans = min(ans, temp); } return ans; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...