Submission #99997

#TimeUsernameProblemLanguageResultExecution timeMemory
99997rocketninja7Roller Coaster Railroad (IOI16_railroad)C++14
Compilation error
0 ms0 KiB
#include "railroad.h" long long int memo[16][1<<16]; long long int recursion(int curr, int bitmask, std::vector<int> s, std::vector<int> t){ if(memo[curr][bitmask]!=-1){ return memo[curr][bitmask]; } long long int ans=15000000000; for(int i=0;i<s.size();i++){ if(bitmask&(1<<i)){ ans=std::min(ans, recursion(i, bitmask-(1<<i), s, t)+t[curr]-s[i]); } } return memo[curr][bitmask]=ans; } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); if(n<=16){ long long int ans=15000000000; for(int i=0;i<n;i++){ ans=std::min(ans, recursion(i, (1<<n)-1-(i<<i), s, t)); } return ans; } std::pair<int, int> tsect[n]; for(int i=0;i<n;i++){ tsect[i]=std::make_pair(t[i], i); } std::sort(tsect, tsect+n); return 0; }

Compilation message (stderr)

railroad.cpp: In function 'long long int recursion(int, int, std::vector<int>, std::vector<int>)':
railroad.cpp:10:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<s.size();i++){
                 ~^~~~~~~~~
railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:31:10: error: 'sort' is not a member of 'std'
     std::sort(tsect, tsect+n);
          ^~~~