제출 #265531

#제출 시각아이디문제언어결과실행 시간메모리
265531themax23Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
2069 ms4616 KiB
#include "railroad.h" #include <bits/stdc++.h> #define deb(x) cerr << #x <<": " << x << '\n'; using namespace std; typedef long long ll; const int INF = 1e9 + 1; 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...