Submission #789788

#TimeUsernameProblemLanguageResultExecution timeMemory
789788ShithilaRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2065 ms4180 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); vector<int> arr(n,0); long long min=0; for(int i=0;i<n;i++) { arr[i]=i; if(i>0 && s[arr[i]]<t[arr[i-1]]) { min=min-s[arr[i]]+t[arr[i-1]]; } } do { long long tempmin=0; for(int i=0;i<n;i++) { if(i>0 && s[arr[i]]<t[arr[i-1]]) { tempmin=tempmin-s[arr[i]]+t[arr[i-1]]; } } if(tempmin<min) { min=tempmin; } } while (next_permutation(arr.begin(),arr.end())); return min; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...