Submission #233904

#TimeUsernameProblemLanguageResultExecution timeMemory
233904parsa_mobedCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "coprobber.h" using namespace std; #define pii pair <int , int> #define F first #define S second #define num(i, j) i * n + j int deg[MAX_N], Win[MAX_N][MAX_N], Cnt[MAX_N][MAX_N], Par[MAX_N][MAX_N], curPos; int start(int N, bool A[MAX_N][MAX_N]) { for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) deg[i] += A[i][j]; for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) Cnt[i][j] = deg[j]; queue <pii> q; for (int i = 0; i < N; i++) for (int t = 0; t < 2; t++) q.push({num(i, i), t}), Par[i][i] = i, Win[i][i] = 1; while (!q.empty()) { pii p = q.front(); q.pop(); int cop = p.F / N, rob = p.F % N; if (p.S == 0) { // Rober turn for (int u = 0; u < N; u++) if (A[u][cop] && !Win[u][rob]) Win[u][rob] = 1, Par[u][rob] = cop, q.push({num(u, rob), 1}); } else { // Cop turn for (int u = 0; u < N; u++) if (A[u][rob]) { Cnt[cop][u]--; if (Cnt[cop][u] == 0) q.push({num(cop, u), 0}); } } } for (int i = 0; i < N; i++) { bool Can = 1; for (int j = 0; j < N; j++) Can &= Win[i][j]; if (Can) return curPos; } return -1; } int nextMove(int robber) { return curPos = Par[curPos][robber]; }

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:8:23: error: 'n' was not declared in this scope
 #define num(i, j) i * n + j
                       ^
coprobber.cpp:15:69: note: in expansion of macro 'num'
     for (int i = 0; i < N; i++) for (int t = 0; t < 2; t++) q.push({num(i, i), t}), Par[i][i] = i, Win[i][i] = 1;
                                                                     ^~~
coprobber.cpp:15:82: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
     for (int i = 0; i < N; i++) for (int t = 0; t < 2; t++) q.push({num(i, i), t}), Par[i][i] = i, Win[i][i] = 1;
                                                                                  ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from coprobber.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:251:7: note: candidate: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:251:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/7/bits/stl_queue.h:256:7: note: candidate: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:256:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
coprobber.cpp:8:23: error: 'n' was not declared in this scope
 #define num(i, j) i * n + j
                       ^
coprobber.cpp:23:65: note: in expansion of macro 'num'
                     Win[u][rob] = 1, Par[u][rob] = cop, q.push({num(u, rob), 1});
                                                                 ^~~
coprobber.cpp:23:80: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                     Win[u][rob] = 1, Par[u][rob] = cop, q.push({num(u, rob), 1});
                                                                                ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from coprobber.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:251:7: note: candidate: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:251:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/7/bits/stl_queue.h:256:7: note: candidate: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:256:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'
coprobber.cpp:8:23: error: 'n' was not declared in this scope
 #define num(i, j) i * n + j
                       ^
coprobber.cpp:28:47: note: in expansion of macro 'num'
                 if (Cnt[cop][u] == 0) q.push({num(cop, u), 0});
                                               ^~~
coprobber.cpp:28:62: error: no matching function for call to 'std::queue<std::pair<int, int> >::push(<brace-enclosed initializer list>)'
                 if (Cnt[cop][u] == 0) q.push({num(cop, u), 0});
                                                              ^
In file included from /usr/include/c++/7/queue:64:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from coprobber.cpp:1:
/usr/include/c++/7/bits/stl_queue.h:251:7: note: candidate: void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(const value_type& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:251:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type& {aka const std::pair<int, int>&}'
/usr/include/c++/7/bits/stl_queue.h:256:7: note: candidate: void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<int, int>; _Sequence = std::deque<std::pair<int, int>, std::allocator<std::pair<int, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<int, int>]
       push(value_type&& __x)
       ^~~~
/usr/include/c++/7/bits/stl_queue.h:256:7: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<int, int> >::value_type&& {aka std::pair<int, int>&&}'