Submission #789787

#TimeUsernameProblemLanguageResultExecution timeMemory
789787ShithilaRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
2060 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); int 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 { int 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...