Submission #1018162

#TimeUsernameProblemLanguageResultExecution timeMemory
1018162woodRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2040 ms9412 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define eb emplace_back #define fi first #define se second typedef pair<int,int> p32; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int res = INT_MAX; int n = (int) s.size(); vector<p32> arr; for(int i = 0; i<n; i++){ arr.eb(s[i],t[i]); } do{ int cost = 0; for(int i = 1; i<n; i++){ cost +=max(0,arr[i-1].se-arr[i].fi); } res = min(res,cost); }while(next_permutation(arr.begin(),arr.end())); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...