Submission #574466

#TimeUsernameProblemLanguageResultExecution timeMemory
574466EliasRoller Coaster Railroad (IOI16_railroad)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #ifndef _DEBUG #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx") #include "railroad.h" #endif using namespace std; int64_t plan_roller_coaster(vector<int> s, vector<int> t) { int n = s.size(); vector<vector<int>> dp((1 << n) + 1, vector<int>(n, INT32_MAX)); dp[0][0] = 0; for (int i = 0; i < n; i++) { dp[1 << i][i] = 0; } for (int bits = 1; bits < (1 << n) + 1; bits++) for (int i = 0; i < n; i++) { if (bits & (1 << i) == 0) continue; for (int j = 0; j < n; j++) { if (i == j || bits & (1 << j) == 0) continue; dp[bits][i] = min(dp[bits][i], dp[bits ^ (1 << i)][j] + max(t[j] - s[i], 0)); } } return *min_element(dp[(1 << n) - 1].begin(), dp[(1 << n) - 1].end()); }

Compilation message (stderr)

railroad.cpp:12:9: error: ambiguating new declaration of 'int64_t plan_roller_coaster(std::vector<int>, std::vector<int>)'
   12 | int64_t plan_roller_coaster(vector<int> s, vector<int> t)
      |         ^~~~~~~~~~~~~~~~~~~
In file included from railroad.cpp:7:
railroad.h:5:11: note: old declaration 'long long int plan_roller_coaster(std::vector<int>, std::vector<int>)'
    5 | long long plan_roller_coaster(std::vector<int> s, std::vector<int> t);
      |           ^~~~~~~~~~~~~~~~~~~
railroad.cpp: In function 'int64_t plan_roller_coaster(std::vector<int>, std::vector<int>)':
railroad.cpp:26:33: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   26 |             if (bits & (1 << i) == 0)
      |                        ~~~~~~~~~^~~~
railroad.cpp:31:47: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
   31 |                 if (i == j || bits & (1 << j) == 0)
      |                                      ~~~~~~~~~^~~~