제출 #312275

#제출 시각아이디문제언어결과실행 시간메모리
312275aZvezda경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; //#pragma GCC optimize ("O3") //#pragma GCC target ("sse4") #define endl "\n" typedef long long ll; template<class T, class T2> inline ostream &operator <<(ostream &out, const pair<T, T2> &x) { out << x.first << " " << x.second; return out;} template<class T, class T2> inline istream &operator >>(istream &in, pair<T, T2> &x) { in >> x.first >> x.second; return in;} template<class T, class T2> inline bool chkmax(T &x, const T2 &y) { return x < y ? x = y, 1 : 0; } template<class T, class T2> inline bool chkmin(T &x, const T2 &y) { return x > y ? x = y, 1 : 0; } const ll mod = 1e9 + 7; #define out(x) "{" << (#x) << ": " << x << "} " bool win[MAX_N][MAX_N][2]; int hist[MAX_N][MAX_N][2]; bool used[MAX_N][MAX_N][2]; vector<int> g[MAX_N]; int n, cnt[MAX_N]; int cntChase[MAX_N][MAX_N][2]; int current; int start(int N, bool A[MAX_N][MAX_N]) { n = N; for(int i = 0; i < n; i ++) { for(int j = 0; j < n; j ++) { if(A[i][j] == 1 || i == j) { g[i].push_back(j); cnt[i] ++; } } } queue<pair<pair<int, int>, int> > q; for(int i = 0; i < n; i ++) { for(int j = 0; j < n; j ++) { cntChase[i][j][0] = cnt[j] - 1; cntChase[i][j][1] = cnt[i] - 1; } } for(int i = 0; i < n; i ++) { win[i][i][0] = win[i][i][1] = true; used[i][i][0] = used[i][i][1] = true; q.push({{i, i}, 0}); q.push({{i, i}, 1}); } while(!q.empty()) { auto curr = q.front(); q.pop(); int a, b, who; a = curr.first.first; b = curr.first.second; who = curr.second; if(who) { for(auto it : g[a]) { if(used[it][b][who ^ 1]) {continue;} win[it][b][who ^ 1] = true; hist[it][b][who ^ 1] = a; used[it][b][who ^ 1] = true; q.push({{it, b}, who ^ 1}); } } else { for(auto it : g[b]) { if(used[a][it][who ^ 1] || it == b) {continue;} cntChase[a][it][who ^ 1] --; if(cntChase[a][it][who ^ 1] > 0) {continue;} win[a][it][who ^ 1] = true; used[a][it][who ^ 1] = true; q.push({{a, it}, who ^ 1}); } } } for(int i = 0; i < n; i ++) { for(int j = 0; j < n; j ++) { if(!win[i][j][0]) {break;} if(j == n - 1) { return current = i; } } } return -1; } int nextMove(int R) { return current = hist[current][R][0]; }

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

coprobber.cpp:14:10: error: 'MAX_N' was not declared in this scope
   14 | bool win[MAX_N][MAX_N][2];
      |          ^~~~~
coprobber.cpp:14:17: error: 'MAX_N' was not declared in this scope
   14 | bool win[MAX_N][MAX_N][2];
      |                 ^~~~~
coprobber.cpp:15:10: error: 'MAX_N' was not declared in this scope
   15 | int hist[MAX_N][MAX_N][2];
      |          ^~~~~
coprobber.cpp:15:17: error: 'MAX_N' was not declared in this scope
   15 | int hist[MAX_N][MAX_N][2];
      |                 ^~~~~
coprobber.cpp:16:11: error: 'MAX_N' was not declared in this scope
   16 | bool used[MAX_N][MAX_N][2];
      |           ^~~~~
coprobber.cpp:16:18: error: 'MAX_N' was not declared in this scope
   16 | bool used[MAX_N][MAX_N][2];
      |                  ^~~~~
coprobber.cpp:17:15: error: 'MAX_N' was not declared in this scope
   17 | vector<int> g[MAX_N];
      |               ^~~~~
coprobber.cpp:18:12: error: 'MAX_N' was not declared in this scope
   18 | int n, cnt[MAX_N];
      |            ^~~~~
coprobber.cpp:19:14: error: 'MAX_N' was not declared in this scope
   19 | int cntChase[MAX_N][MAX_N][2];
      |              ^~~~~
coprobber.cpp:19:21: error: 'MAX_N' was not declared in this scope
   19 | int cntChase[MAX_N][MAX_N][2];
      |                     ^~~~~
coprobber.cpp:22:25: error: 'MAX_N' was not declared in this scope
   22 | int start(int N, bool A[MAX_N][MAX_N]) {
      |                         ^~~~~
coprobber.cpp:22:32: error: 'MAX_N' was not declared in this scope
   22 | int start(int N, bool A[MAX_N][MAX_N]) {
      |                                ^~~~~
coprobber.cpp: In function 'int start(...)':
coprobber.cpp:23:9: error: 'N' was not declared in this scope
   23 |     n = N;
      |         ^
coprobber.cpp:26:16: error: 'A' was not declared in this scope
   26 |             if(A[i][j] == 1 || i == j) {
      |                ^
coprobber.cpp:27:17: error: 'g' was not declared in this scope
   27 |                 g[i].push_back(j);
      |                 ^
coprobber.cpp:28:17: error: 'cnt' was not declared in this scope; did you mean 'int'?
   28 |                 cnt[i] ++;
      |                 ^~~
      |                 int
coprobber.cpp:35:13: error: 'cntChase' was not declared in this scope
   35 |             cntChase[i][j][0] = cnt[j] - 1;
      |             ^~~~~~~~
coprobber.cpp:35:33: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |             cntChase[i][j][0] = cnt[j] - 1;
      |                                 ^~~
      |                                 int
coprobber.cpp:40:9: error: 'win' was not declared in this scope; did you mean 'sin'?
   40 |         win[i][i][0] = win[i][i][1] = true;
      |         ^~~
      |         sin
coprobber.cpp:41:9: error: 'used' was not declared in this scope
   41 |         used[i][i][0] = used[i][i][1] = true;
      |         ^~~~
coprobber.cpp:51:27: error: 'g' was not declared in this scope
   51 |             for(auto it : g[a]) {
      |                           ^
coprobber.cpp:52:20: error: 'used' was not declared in this scope
   52 |                 if(used[it][b][who ^ 1]) {continue;}
      |                    ^~~~
coprobber.cpp:53:17: error: 'win' was not declared in this scope; did you mean 'sin'?
   53 |                 win[it][b][who ^ 1] = true;
      |                 ^~~
      |                 sin
coprobber.cpp:54:17: error: 'hist' was not declared in this scope
   54 |                 hist[it][b][who ^ 1] = a;
      |                 ^~~~
coprobber.cpp:55:17: error: 'used' was not declared in this scope
   55 |                 used[it][b][who ^ 1] = true;
      |                 ^~~~
coprobber.cpp:56:42: error: no matching function for call to 'std::queue<std::pair<std::pair<int, int>, int> >::push(<brace-enclosed initializer list>)'
   56 |                 q.push({{it, b}, who ^ 1});
      |                                          ^
In file included from /usr/include/c++/9/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from coprobber.cpp:1:
/usr/include/c++/9/bits/stl_queue.h:259:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<std::pair<int, int>, int>]'
  259 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:259:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'}
  259 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:264:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<std::pair<int, int>, int>]'
  264 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:264:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<std::pair<int, int>, int> >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'}
  264 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
coprobber.cpp:59:27: error: 'g' was not declared in this scope
   59 |             for(auto it : g[b]) {
      |                           ^
coprobber.cpp:60:20: error: 'used' was not declared in this scope
   60 |                 if(used[a][it][who ^ 1] || it == b) {continue;}
      |                    ^~~~
coprobber.cpp:61:17: error: 'cntChase' was not declared in this scope
   61 |                 cntChase[a][it][who ^ 1] --; if(cntChase[a][it][who ^ 1] > 0) {continue;}
      |                 ^~~~~~~~
coprobber.cpp:62:17: error: 'win' was not declared in this scope; did you mean 'sin'?
   62 |                 win[a][it][who ^ 1] = true;
      |                 ^~~
      |                 sin
coprobber.cpp:63:17: error: 'used' was not declared in this scope
   63 |                 used[a][it][who ^ 1] = true;
      |                 ^~~~
coprobber.cpp:64:42: error: no matching function for call to 'std::queue<std::pair<std::pair<int, int>, int> >::push(<brace-enclosed initializer list>)'
   64 |                 q.push({{a, it}, who ^ 1});
      |                                          ^
In file included from /usr/include/c++/9/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from coprobber.cpp:1:
/usr/include/c++/9/bits/stl_queue.h:259:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<std::pair<int, int>, int>]'
  259 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:259:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<std::pair<int, int>, int>&'}
  259 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:264:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(std::queue<_Tp, _Sequence>::value_type&&) [with _Tp = std::pair<std::pair<int, int>, int>; _Sequence = std::deque<std::pair<std::pair<int, int>, int>, std::allocator<std::pair<std::pair<int, int>, int> > >; std::queue<_Tp, _Sequence>::value_type = std::pair<std::pair<int, int>, int>]'
  264 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:264:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::queue<std::pair<std::pair<int, int>, int> >::value_type&&' {aka 'std::pair<std::pair<int, int>, int>&&'}
  264 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~
coprobber.cpp:71:17: error: 'win' was not declared in this scope; did you mean 'sin'?
   71 |             if(!win[i][j][0]) {break;}
      |                 ^~~
      |                 sin
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:81:22: error: 'hist' was not declared in this scope
   81 |     return current = hist[current][R][0];
      |                      ^~~~