Submission #991584

#TimeUsernameProblemLanguageResultExecution timeMemory
991584KasymKRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2052 ms8028 KiB
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; long long plan_roller_coaster(vector<int> s, vector<int> t){ int n = (int)s.size(); vector<int> next(n); for(int i = 0; i < n; ++i) next[i] = i; // next vector is sorted long long answer = INF; do{ long long sum = 0; for(int i = 1; i < n; ++i) sum += max(0, t[next[i-1]]-s[next[i]]); answer = min(answer, sum); }while(next_permutation(next.begin(), next.end())); return answer; } // int main(){ // long long jogap = plan_roller_coaster({1, 4, 5, 6}, {7, 3, 8, 6}); // printf("%lld", jogap); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...