Submission #1025036

#TimeUsernameProblemLanguageResultExecution timeMemory
1025036slivajanRoller Coaster Railroad (IOI16_railroad)C++17
11 / 100
28 ms7240 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; typedef long long un; typedef vector<un> vuc; #define REP(i, a, b) for(un i = a; i < b; i++) #define FEAC(i, a) for (auto&& i : a) #define vec vector #define ALL(x) (x).begin(), (x).end() constexpr un INF = INT64_MAX; un compute(vec<int> s, vec<int> t, un N, vuc perm){ un ret = 0; REP(i, 0, N-1){ ret += max(0, t[perm[i]] - s[perm[i+1]]); } return ret; } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { un N = (un) s.size(); if (N > 8) return 0; vuc perm(N); iota(ALL(perm), 0); un ret = INF; do{ ret = min(ret, compute(s, t, N, perm)); } while(next_permutation(ALL(perm))); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...