Submission #100054

#TimeUsernameProblemLanguageResultExecution timeMemory
100054helloworldworldRoller Coaster Railroad (IOI16_railroad)C++14
Compilation error
0 ms0 KiB
#include "railroad.h" long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); int arr[n]; for(int i=0;i<n;i++) arr[i]=i; long long mini,cur; for(int i=1;i<n;i++){ if(t[i-1]>s[i]) cur+=t[i-1]-s[i]; } mini=cur; while(next_permutation(arr,arr+n)){ for(int i=1;i<n;i++){ if(t[i-1]>s[i]) cur+=t[i-1]-s[i]; } if(mini>cur) mini=cur; } return mini; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:14:11: error: 'next_permutation' was not declared in this scope
     while(next_permutation(arr,arr+n)){
           ^~~~~~~~~~~~~~~~