Submission #1062962

#TimeUsernameProblemLanguageResultExecution timeMemory
1062962nvujicaRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2100 ms8392 KiB
#include <bits/stdc++.h> #include "railroad.h" #define fi first #define se second #define ll long long using namespace std; const ll inf = (1LL << 60); ll plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); vector <int> v; for(int i = 0; i < n; i++){ v.push_back(i); } ll ans = inf; do{ ll sum = 0; for(int i = 0; i < n - 1; i++){ sum += max(0, t[v[i]] - s[v[i + 1]]); // cout << i << ' ' << t[v[i]] << ' ' << s[v[i + 1]] << endl; } // for(int i = 0; i < n; i++){ // cout << v[i]; // } // cout << ' ' << sum << endl; ans = min(ans, sum); }while(next_permutation(v.begin(), v.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...