Submission #123473

#TimeUsernameProblemLanguageResultExecution timeMemory
123473baqargamRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
83 ms10672 KiB
#include "bits/stdc++.h" #include "railroad.h" using namespace std; long long j,l,dp[1000000],g[100]; vector<pair<int,int> >v; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); for(int i=0;i<(1<<n);i++){ int ct=__builtin_popcount(i); v.push_back({ct,i}); } for(int i=n;i<(1<<n);i++){ dp[i]=1000000000000000000; } for(int i=0;i<v.size();i++){ int a=v[i].second; for(j=a,l=0;j>0;j>>=1,l++) g[l]=j%2; for(int j=0;j<l;j++){ if(g[j]==1) { for(int i=0;i<n;i++){ if(g[i]==0) { dp[a+(1<<i)]=min(dp[a+(1ll<<i)],dp[a]+max(0,s[i]-t[j])); } } } } } return dp[(1<<n)-1]; }

Compilation message (stderr)

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<v.size();i++){
                 ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...