제출 #591545

#제출 시각아이디문제언어결과실행 시간메모리
591545yutabiRoller Coaster Railroad (IOI16_railroad)C++14
34 / 100
46 ms8732 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; #define pb push_back typedef long long ll; typedef pair <int,int> ii; ll DP[1<<16][16]; ll nw[1<<16][16]; ll maxi=1000000000000000007; vector <int> srs; bool srs2[1<<16]; vector <int> srs_nw; 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++) { for(int j=0;j<n;j++) { DP[i][j]=maxi; } } for(int i=0;i<n;i++) { DP[1<<i][i]=0; srs.pb(1<<i); srs2[1<<i]=1; } for(int l=0;l<n;l++) { for(int i=0;i<n;i++) { for(int _j=0;_j<srs.size();_j++) { int j=srs[_j]; if(!((1<<i)&(j))) { for(int k=0;k<n;k++) { DP[(1<<i)+j][i]=min(DP[(1<<i)+j][i],DP[j][k]+max(t[k]-s[i],0)); } if(srs2[(1<<i)+j]==0) { srs_nw.pb((1<<i)+j); srs2[(1<<i)+j]=1; } } } } srs=srs_nw; srs_nw.clear(); } ll ans=maxi; for(int i=0;i<n;i++) { ans=min(ans,DP[srs[0]][i]); } /*for(int i=0;i<1<<n;i++) { for(int j=0;j<n;j++) { printf("%lld ",DP[i][j]); } printf("\n"); }*/ return ans; }

컴파일 시 표준 에러 (stderr) 메시지

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:54:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |             for(int _j=0;_j<srs.size();_j++)
      |                          ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...