제출 #468030

#제출 시각아이디문제언어결과실행 시간메모리
468030PietraRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
121 ms167504 KiB
#include<bits/stdc++.h> #include "railroad.h" using namespace std ; const long long inf = 1e18 ; const int maxn = 20 ; long long dp[(1<<maxn)][maxn], n, S[maxn], T[maxn] ; long long solve(int mask, int i){ if(__builtin_popcount(mask) == n+1) return 0 ; long long &mp = dp[mask][i] ; if(mp != -1) return mp ; mp = inf ; for(int j = 0 ; j <= n ; j++){ if(mask&(1<<j)) continue ; mp = min(mp, max(0LL, T[i] - S[j]) + solve(mask|(1<<j), j)) ; } return mp ; } long long plan_roller_coaster(vector<int> s, vector<int> t){ n = (int) s.size() ; memset(dp, -1, sizeof dp) ; for(int i = 0 ; i < s.size() ; i++) S[i] = s[i], T[i] = t[i] ; return solve(1, 0) ; } /* int main(){ cin >> n ; memset(dp, -1, sizeof dp) ; for(int i = 0 ; i < n ; i++) cin >> S[i] >> T[i] ; cout << solve(1, 0) << "\n" ; }*/

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

railroad.cpp: In function 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  for(int i = 0 ; i < s.size() ; i++) S[i] = s[i], T[i] = t[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...