제출 #262506

#제출 시각아이디문제언어결과실행 시간메모리
262506amallaRoller Coaster Railroad (IOI16_railroad)C++17
0 / 100
390 ms524292 KiB
#include "railroad.h" #include<bits/stdc++.h> using namespace std; int N; vector<int> S, T; vector<vector<long long> > memo((1<<16)+20, vector<long long>(17) ); vector<vector<bool> > vis((1<<16)+20, vector<bool>(17, false) ); long long DP(int mask, int curr) { if (__builtin_popcount(mask) == N) return 0; if (vis[mask][curr]) return memo[mask][curr]; long long ans = 1000000000000000000; for (int i = 0; i<N; ++i) { if (i&(mask)) continue; if (T[curr]>S[i]) ans = min(ans, DP( mask|1<<i, i) + T[curr]-S[i] ); else ans = ans = min(ans, DP( mask|1<<i, i) ); } memo[mask][curr] = ans; vis[mask][curr] = true; return memo[mask][curr]; } long long plan_roller_coaster(vector<int> s, vector<int> t) { N = (int) s.size(); S = s; T = t; return DP(0,1); }

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

railroad.cpp: In function 'long long int DP(int, int)':
railroad.cpp:19:18: warning: operation on 'ans' may be undefined [-Wsequence-point]
   19 |         else ans = ans = min(ans, DP( mask|1<<i, 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...