제출 #879794

#제출 시각아이디문제언어결과실행 시간메모리
879794Muaath_5게임 (IOI14_game)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void initialize(int n); int hasEdge(int u, int v); int n; map<pair<int, int>, int> mp; int par[N]; int root(int x) { return x == par[x] ? x : par[x] = root(par[x]); } void merge(int u, int v) { u = root(u), v = root(v); if (u == v) return; par[v] = u; } void initialize(int cnt) { n = cnt; mp.clear(); for (int i = 1; i <= cnt; i++) par[i] = i; } int hasEdge(int u, int v) { if (u > v) swap(u, v); if (root(u) == root(v)) return 1; mp[{u, v}]++; if (mp[{u, v}] == n-1) { merge(u, v); return 1; } return 0; }

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

game.cpp:10:9: error: 'N' was not declared in this scope
   10 | int par[N];
      |         ^
game.cpp: In function 'int root(int)':
game.cpp:12:14: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   12 |  return x == par[x] ? x : par[x] = root(par[x]);
      |              ^~~
      |              __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
game.cpp: In function 'void merge(int, int)':
game.cpp:17:4: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   17 |    par[v] = u;
      |    ^~~
      |    __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~
game.cpp: In function 'void initialize(int)':
game.cpp:25:5: error: 'par' was not declared in this scope; did you mean '__pstl::execution::v1::par'?
   25 |     par[i] = i;
      |     ^~~
      |     __pstl::execution::v1::par
In file included from /usr/include/c++/10/pstl/glue_algorithm_defs.h:15,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/10/pstl/execution_defs.h:111:27: note: '__pstl::execution::v1::par' declared here
  111 | constexpr parallel_policy par{};
      |                           ^~~