Submission #429057

#TimeUsernameProblemLanguageResultExecution timeMemory
429057LouayFarahRoller Coaster Railroad (IOI16_railroad)C++14
11 / 100
2074 ms7988 KiB
#include "bits/stdc++.h" #include "railroad.h" using namespace std; long long plan_roller_coaster(vector<int> s, vector<int> t) { int n = (int)s.size(); if(n<=16) { vector<int> pos(n); for(int i = 0; i<n; i++) pos[i] = i; long long res = 1e18; do { int speed = 1; long long curr = 0; for(int i = 0; i<n; i++) { if(speed>s[pos[i]]) curr+=speed-s[pos[i]]; speed = t[pos[i]]; } res = min(res, curr); }while(next_permutation(pos.begin(), pos.end())); return res; } }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
   32 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...