제출 #119148

#제출 시각아이디문제언어결과실행 시간메모리
119148imyujin경찰관과 강도 (BOI14_coprobber)C++14
컴파일 에러
0 ms0 KiB
#include "coprobber.h" #include<queue> using namespace std; typedef tuple<int, int, int> tiii; const int INF=MAX_N*MAX_N; bool adj[MAX_N][MAX_N]; bool chk[MAX_N][MAX_N]; int dp[MAX_N][MAX_N][2], deg[MAX_N][MAX_N]; queue<tiii> q; int p; int start(int N, bool A[MAX_N][MAX_N]){ for(int i=0; i<N; i++) for(int j=0; j<N; j++){ adj[i][j]=A[i][j]; dp[i][j][0]=dp[i][j][1]=-1; if(A[i][j]) deg[0][i]++; } for(int i=0; i<N; i++) for(int j=1; j<N; j++) deg[j][i]=deg[0][i]; for(int i=0; i<N; i++){ q.push((tiii){i, i, 0}); q.push((tiii){i, i, 1}); dp[i][i][0]=dp[i][i][1]=0; } while(!q.empty()){ int c, r, t; tie(c, r, t)=q.front(); q.pop(); //printf("[%d %d %d]\n", c, r, t); if(t==0){ for(int i=0; i<N; i++) if(A[i][r]&&dp[c][i][1]==-1){ deg[c][i]--; if(deg[c][i]==0){ //printf("(%d %d %d)\n", c, i, 1); q.push((tiii){c, i, 1}); dp[c][i][1]=dp[c][r][t]+1; } } } else{ for(int i=0; i<N; i++) if((c==i||A[c][i])&&dp[i][r][0]==-1){ //printf("(%d %d %d)\n", i, r, 0); q.push((tiii){i, r, 0}); dp[i][r][0]=dp[c][r][t]+1; } } } /* for(int k=0; k<2; k++){ for(int i=0; i<N; i++){ for(int j=0; j<N; j++) printf("%d ", dp[i][j][0]); printf("\n"); } printf("****\n"); } */ for(int i=0; i<N; i++){ bool b=true; for(int j=0; j<N; j++) if(dp[i][j][0]==-1) b=false; if(b) return p=i; } return -1; } int nextMove(int R){ for(int i=0;; i++) if((adj[p][i]||i==p)&&dp[i][R][1]==dp[p][R][0]-1) return p=i; //return -1; }

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

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:24:24: error: too many initializers for 'tiii {aka std::tuple<int, int, int>}'
   q.push((tiii){i, i, 0});
                        ^
coprobber.cpp:24:24: error: invalid use of incomplete type 'tiii {aka class std::tuple<int, int, int>}'
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'tiii {aka class std::tuple<int, int, int>}'
     class tuple;
           ^~~~~
coprobber.cpp:25:24: error: too many initializers for 'tiii {aka std::tuple<int, int, int>}'
   q.push((tiii){i, i, 1});
                        ^
coprobber.cpp:25:24: error: invalid use of incomplete type 'tiii {aka class std::tuple<int, int, int>}'
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'tiii {aka class std::tuple<int, int, int>}'
     class tuple;
           ^~~~~
coprobber.cpp:30:3: error: 'tie' was not declared in this scope
   tie(c, r, t)=q.front();
   ^~~
coprobber.cpp:30:3: note: suggested alternative: 'tiii'
   tie(c, r, t)=q.front();
   ^~~
   tiii
coprobber.cpp:38:27: error: too many initializers for 'tiii {aka std::tuple<int, int, int>}'
      q.push((tiii){c, i, 1});
                           ^
coprobber.cpp:38:27: error: invalid use of incomplete type 'tiii {aka class std::tuple<int, int, int>}'
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'tiii {aka class std::tuple<int, int, int>}'
     class tuple;
           ^~~~~
coprobber.cpp:46:26: error: too many initializers for 'tiii {aka std::tuple<int, int, int>}'
     q.push((tiii){i, r, 0});
                          ^
coprobber.cpp:46:26: error: invalid use of incomplete type 'tiii {aka class std::tuple<int, int, int>}'
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'tiii {aka class std::tuple<int, int, int>}'
     class tuple;
           ^~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/bits/stl_deque.h: In instantiation of 'void std::deque<_Tp, _Alloc>::pop_front() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]':
/usr/include/c++/7/bits/stl_queue.h:287:2:   required from 'void std::queue<_Tp, _Sequence>::pop() [with _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]'
coprobber.cpp:31:9:   required from here
/usr/include/c++/7/bits/stl_deque.h:1582:40: error: invalid use of incomplete type 'class std::tuple<int, int, int>'
      != this->_M_impl._M_start._M_last - 1)
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'class std::tuple<int, int, int>'
     class tuple;
           ^~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/bits/stl_deque.h:1586:6: error: cannot increment a pointer to incomplete type 'std::tuple<int, int, int>'
      ++this->_M_impl._M_start._M_cur;
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/7/bits/stl_deque.h: In instantiation of 'void std::deque<_Tp, _Alloc>::_M_destroy_data(std::deque<_Tp, _Alloc>::iterator, std::deque<_Tp, _Alloc>::iterator, const std::allocator<_Tp1>&) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::deque<_Tp, _Alloc>::iterator = std::_Deque_iterator<std::tuple<int, int, int>, std::tuple<int, int, int>&, std::tuple<int, int, int>*>]':
/usr/include/c++/7/bits/stl_deque.h:1045:24:   required from 'std::deque<_Tp, _Alloc>::~deque() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]'
/usr/include/c++/7/bits/stl_queue.h:153:6:   required from 'std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; _Requires = void; _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]'
coprobber.cpp:13:13:   required from here
/usr/include/c++/7/bits/stl_deque.h:2071:6: error: invalid use of incomplete type 'std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >::value_type {aka class std::tuple<int, int, int>}'
  if (!__has_trivial_destructor(value_type))
In file included from /usr/include/c++/7/bits/move.h:54:0,
                 from /usr/include/c++/7/bits/stl_pair.h:59,
                 from /usr/include/c++/7/bits/stl_algobase.h:64,
                 from /usr/include/c++/7/deque:60,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/type_traits:2555:11: note: declaration of 'std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >::value_type {aka class std::tuple<int, int, int>}'
     class tuple;
           ^~~~~
In file included from /usr/include/c++/7/deque:64:0,
                 from /usr/include/c++/7/queue:60,
                 from coprobber.cpp:2:
/usr/include/c++/7/bits/stl_deque.h: In instantiation of 'void std::_Deque_base<_Tp, _Alloc>::_M_initialize_map(std::size_t) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::size_t = long unsigned int]':
/usr/include/c++/7/bits/stl_deque.h:492:26:   required from 'std::_Deque_base<_Tp, _Alloc>::_Deque_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]'
/usr/include/c++/7/bits/stl_deque.h:888:23:   required from 'std::deque<_Tp, _Alloc>::deque() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]'
/usr/include/c++/7/bits/stl_queue.h:153:6:   required from 'std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; _Requires = void; _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]'
coprobber.cpp:13:13:   required from here
/usr/include/c++/7/bits/stl_deque.h:684:74: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, int>'
       const size_t __num_nodes = (__num_elements/ __deque_buf_size(sizeof(_Tp))
                                                                          ^
/usr/include/c++/7/bits/stl_deque.h:715:31: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, int>'
      % __deque_buf_size(sizeof(_Tp)));
                               ^
/usr/include/c++/7/bits/stl_deque.h: In instantiation of 'void std::_Deque_base<_Tp, _Alloc>::_M_deallocate_node(std::_Deque_base<_Tp, _Alloc>::_Ptr) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::_Deque_base<_Tp, _Alloc>::_Ptr = std::tuple<int, int, int>*]':
/usr/include/c++/7/bits/stl_deque.h:743:20:   required from 'void std::_Deque_base<_Tp, _Alloc>::_M_destroy_nodes(std::_Deque_base<_Tp, _Alloc>::_Map_pointer, std::_Deque_base<_Tp, _Alloc>::_Map_pointer) [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >; std::_Deque_base<_Tp, _Alloc>::_Map_pointer = std::tuple<int, int, int>**]'
/usr/include/c++/7/bits/stl_deque.h:665:20:   required from 'std::_Deque_base<_Tp, _Alloc>::~_Deque_base() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]'
/usr/include/c++/7/bits/stl_deque.h:888:23:   required from 'std::deque<_Tp, _Alloc>::deque() [with _Tp = std::tuple<int, int, int>; _Alloc = std::allocator<std::tuple<int, int, int> >]'
/usr/include/c++/7/bits/stl_queue.h:153:6:   required from 'std::queue<_Tp, _Sequence>::queue() [with _Seq = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >; _Requires = void; _Tp = std::tuple<int, int, int>; _Sequence = std::deque<std::tuple<int, int, int>, std::allocator<std::tuple<int, int, int> > >]'
coprobber.cpp:13:13:   required from here
/usr/include/c++/7/bits/stl_deque.h:609:59: error: invalid application of 'sizeof' to incomplete type 'std::tuple<int, int, int>'
  _Traits::deallocate(_M_impl, __p, __deque_buf_size(sizeof(_Tp)));
                                                           ^