Submission #511063

#TimeUsernameProblemLanguageResultExecution timeMemory
511063tabrTropical Garden (IOI11_garden)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif #include "garden.h" #include "gardenlib.h" int count_routes(int n, int m, int p, int r[][2], int q, int k[]) { vector<vector<int>> g(n); for (int i = 0; i < m; i++) { g[r[i][0]].emplace_back(g[r[i][1]]); g[r[i][1]].emplace_back(g[r[i][0]]); } vector<vector<int>> nxt(30, vector<int>(2 * n)); for (int i = 0; i < n; i++) { nxt[0][i] = g[i][0] + n; nxt[0][i + n] = g[i][min((int) g[i].size(), 1)]; } for (int i = 1; i < 30; i++) { for (int j = 0; j < 2 * n; j++) { nxt[i][j] = nxt[i - 1][nxt[i - 1][j]]; } } for (int i = 0; i < q; i++) { int ans = 0; for (int j = 0; j < n; j++) { int v = j; for (int l = 29; l >= 0; l--) { if (k[i] & (1 << l)) { v = nxt[l][v]; } } if (v == p % n) { ans++; } } answer(ans); } } #ifdef tabr int main() { ios::sync_with_stdio(false); cin.tie(0); return 0; } #endif

Compilation message (stderr)

garden.cpp:12:5: error: ambiguating new declaration of 'int count_routes(int, int, int, int (*)[2], int, int*)'
   12 | int count_routes(int n, int m, int p, int r[][2], int q, int k[]) {
      |     ^~~~~~~~~~~~
In file included from garden.cpp:9:
garden.h:1:6: note: old declaration 'void count_routes(int, int, int, int (*)[2], int, int*)'
    1 | void count_routes(int N, int M, int P, int R[][2], int Q, int G[]);
      |      ^~~~~~~~~~~~
garden.cpp: In function 'int count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:43:1: warning: no return statement in function returning non-void [-Wreturn-type]
   43 | }
      | ^
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/c++allocator.h:33,
                 from /usr/include/c++/10/bits/allocator.h:46,
                 from /usr/include/c++/10/string:41,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from garden.cpp:1:
/usr/include/c++/10/ext/new_allocator.h: In instantiation of 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = int; _Args = {std::vector<int, std::allocator<int> >&}; _Tp = int]':
/usr/include/c++/10/bits/alloc_traits.h:512:17:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = int; _Args = {std::vector<int, std::allocator<int> >&}; _Tp = int; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<int>]'
/usr/include/c++/10/bits/vector.tcc:115:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {std::vector<int, std::allocator<int> >&}; _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::reference = int&]'
garden.cpp:15:43:   required from here
/usr/include/c++/10/ext/new_allocator.h:150:4: error: cannot convert 'std::vector<int>' to 'int' in initialization
  150 |  { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~