제출 #1119870

#제출 시각아이디문제언어결과실행 시간메모리
1119870PagodePaiva경찰관과 강도 (BOI14_coprobber)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "coprobber.h" const int MAXN = 510; vector <int> g[MAXN]; int pai[MAXN]; int h[MAXN]; vector <pair <int, int>> backedges; void dfs(int v, int p){ pai[v] = p; for(auto x : g[v]){ if(x == p) continue; if(pai[v] != -1){ backedges.push_back({v, x}); continue; } h[x] = h[v]+1; dfs(x, v); } return; } int start(int n, bool a[MAX_N][MAX_N]){ for(int i = 0;i < n;i++){ for(int j = 0;j < n;j++){ if(a[i][j]) g[i].push_back(j); } } dfs(1, 1); int tam = 0; for(auto [a, b] : backedges){ if(h[a] > h[b]) swap(a, b); tam = max(tam, h[b]-h[a]+1); } return (tam >= 5 ? -1 : 0); } int nextMove(int R){ return -1; }

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

coprobber.cpp:5:1: error: 'vector' does not name a type
    5 | vector <int> g[MAXN];
      | ^~~~~~
coprobber.cpp:8:1: error: 'vector' does not name a type
    8 | vector <pair <int, int>> backedges;
      | ^~~~~~
coprobber.cpp: In function 'void dfs(int, int)':
coprobber.cpp:12:18: error: 'g' was not declared in this scope
   12 |     for(auto x : g[v]){
      |                  ^
coprobber.cpp:15:13: error: 'backedges' was not declared in this scope
   15 |             backedges.push_back({v, x});
      |             ^~~~~~~~~
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:28:17: error: 'g' was not declared in this scope
   28 |                 g[i].push_back(j);
      |                 ^
coprobber.cpp:33:23: error: 'backedges' was not declared in this scope
   33 |     for(auto [a, b] : backedges){
      |                       ^~~~~~~~~
coprobber.cpp:34:25: error: 'swap' was not declared in this scope
   34 |         if(h[a] > h[b]) swap(a, b);
      |                         ^~~~
coprobber.cpp:34:25: note: suggested alternatives:
In file included from /usr/include/c++/10/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:110,
                 from coprobber.cpp:1:
/usr/include/c++/10/bits/regex.h:2141:5: note:   'std::__cxx11::swap'
 2141 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/10/bits/stl_pair.h:59,
                 from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from coprobber.cpp:1:
/usr/include/c++/10/bits/move.h:189:5: note:   'std::swap'
  189 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/10/bits/move.h:189:5: note:   'std::swap'
In file included from /usr/include/c++/10/exception:147,
                 from /usr/include/c++/10/ios:39,
                 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 coprobber.cpp:1:
/usr/include/c++/10/bits/exception_ptr.h:169:5: note:   'std::__exception_ptr::swap'
  169 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/10/filesystem:45,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from coprobber.cpp:1:
/usr/include/c++/10/bits/fs_path.h:658:15: note:   'std::filesystem::__cxx11::swap'
  658 |   inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
      |               ^~~~
coprobber.cpp:35:15: error: 'max' was not declared in this scope; did you mean 'std::max'?
   35 |         tam = max(tam, h[b]-h[a]+1);
      |               ^~~
      |               std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from coprobber.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~