Submission #1022223

#TimeUsernameProblemLanguageResultExecution timeMemory
1022223amirhoseinfar1385Roller Coaster Railroad (IOI16_railroad)C++17
Compilation error
0 ms0 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; vector<int>allind; const int maxn=17; long long dp[(1<<maxn)][maxn],inf=1e16; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n=(int)s.size(); for(int mask=1;mask<(1<<n);mask++){ for(int j=0;j<n;j++){ if((mask>>j)&1){ if(__builtin_popcount(mask)==1){ dp[mask][j]=0; continue; } dp[mask][j]=inf; for(int h=0;h<n;h++){ if(h==j||((mask>>h)&1)==0){ continue; } dp[mask][j]=min(dp[mask][j],dp[mask^(1<<j)][h]+max(0,t[h]-s[j])); } }else{ dp[i][j]=inf; } } } long long res=1e16; for(int i=0;i<n;i++){ res=min(res,dp[(1<<n)-1][i]); } return res; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:25:20: error: 'i' was not declared in this scope
   25 |                 dp[i][j]=inf;
      |                    ^