Submission #354339

#TimeUsernameProblemLanguageResultExecution timeMemory
354339KerimRoller Coaster Railroad (IOI16_railroad)C++17
34 / 100
101 ms8940 KiB
#include "railroad.h" #include "bits/stdc++.h" #define MAXN 100009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff first #define ss second #define my_little_dodge 46 #define debug(x) cerr<< #x <<" = "<< x<<endl; using namespace std; typedef long long ll; typedef pair<int,int> PII; template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const ll B=1e15; ll dp[1<<16][16]; vector<int>s,t; int n,all; ll rec(int mask,int last){ if(mask==all) return 0; ll &ret=dp[mask][last]; if(~ret)return ret;ret=B; for(int i=0;i<n;i++) if(!(mask>>i&1)) umin(ret,rec(mask|(1<<i),i)+max(0,t[last]-s[i])); return ret; } long long plan_roller_coaster(vector<int> S, vector<int> T) { s=S;t=T; n = (int) s.size(); if(n<=16){ memset(dp,-1,sizeof dp); all=(1<<n)-1; ll ans=B; for(int i=0;i<n;i++) umin(ans,rec((1<<i),i)); return ans; } return 0; }

Compilation message (stderr)

railroad.cpp: In function 'll rec(int, int)':
railroad.cpp:29:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   29 |  if(~ret)return ret;ret=B;
      |  ^~
railroad.cpp:29:21: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   29 |  if(~ret)return ret;ret=B;
      |                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...