Submission #265534

#TimeUsernameProblemLanguageResultExecution timeMemory
265534themax23Roller Coaster Railroad (IOI16_railroad)C++17
11 / 100
2090 ms4592 KiB
#include "railroad.h" #include <bits/stdc++.h> #define deb(x) cerr << #x <<": " << x << '\n'; using namespace std; typedef long long ll; const ll INF = 1e18; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); vector<int> p; for(int i = 0; i < n; ++i) p.push_back(i); ll ans = INF; do{ ll res = 0; for(ll i = 0; i < n-1; ++i){ res += ( (t[p[i]] - s[p[i+1]]) < 0 ? 0 : t[p[i]] - s[p[i+1]]); } ans = min(ans, res); } while(next_permutation(p.begin(),p.end())); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...