Submission #1160862

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11608622025-03-03 08:17:56JahonaliXGame (IOI14_game)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
struct dsu {
int n;
vector<int> p, c;
dsu(int m) {
n = m;
p.assign(n, 0);
c.assign(n, 1);
iota(p.begin(), p.end(), 0);
}
int find(int x) {
if (x == p[x]) return x;
return p[x] = find(p[x]);
}
void merge(int a, int b) {
p[b] = a;
c[a] += c[b];
}
};
int n;
dsu d;
vector<vector<bool>> v;
void initialize(int N) { n = N, d = dsu(n), v.assign(n, vector<bool>(n)); }
int hasEdge(int u, int v) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

game.cpp:25:5: error: no matching function for call to 'dsu::dsu()'
   25 | dsu d;
      |     ^
game.cpp:8:5: note: candidate: 'dsu::dsu(int)'
    8 |     dsu(int m) {
      |     ^~~
game.cpp:8:5: note:   candidate expects 1 argument, 0 provided
game.cpp:5:8: note: candidate: 'dsu::dsu(const dsu&)'
    5 | struct dsu {
      |        ^~~
game.cpp:5:8: note:   candidate expects 1 argument, 0 provided
game.cpp:5:8: note: candidate: 'dsu::dsu(dsu&&)'
game.cpp:5:8: note:   candidate expects 1 argument, 0 provided
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:33:6: error: invalid types 'int[int]' for array subscript
   33 |     v[u][v] = true;
      |      ^
game.cpp:40:43: error: invalid types 'int[int]' for array subscript
   40 |     for (int i : a) for (int j : b) if (!v[i][j]) return 0;
      |                                           ^
game.cpp:41:10: error: no matching function for call to 'merge(int&, int&)'
   41 |     merge(u, v);
      |     ~~~~~^~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from game.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4927:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter> constexpr _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter)'
 4927 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/11/bits/stl_algo.h:4927:5: note:   template argument deduction/substitution failed:
game.cpp:41:10: note:   candidate expects 5 arguments, 2 provided
   41 |     merge(u, v);
      |     ~~~~~^~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from game.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:4978:5: note: candidate: 'template<class _IIter1, class _IIter2, class _OIter, class _Compare> constexpr _OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter, _Compare)'
 4978 |     merge(_InputIterator1 __first1, _InputIterator1 __last1,
      |     ^~~~~
/usr/include/c++/11/bits/stl_algo.h:4978:5: note:   template argument deduction/substitution failed:
game.cpp:41:10: note:   candidate expects 6 arguments, 2 provided
   41 |     merge(u, v);
      |     ~~~~~^~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:412:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator, class _Compare> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator, _Compare)'
  412 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:412:1: note:   template argument deduction/substitution failed:
game.cpp:41:10: note:   candidate expects 7 arguments, 2 provided
   41 |     merge(u, v);
      |     ~~~~~^~~~~~
In file included from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from game.cpp:1:
/usr/include/c++/11/pstl/glue_algorithm_defs.h:417:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator2> std::merge(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _ForwardIterator)'
  417 | merge(_ExecutionPolicy&& __exec, _ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardIterator2 __first2,
      | ^~~~~
/usr/include/c++/11/pstl/glue_algorithm_defs.h:417:1: note:   template argument deduction/substitution failed:
game.cpp:41:10: note:   candidate expects 6 arguments, 2 provided
   41 |     merge(u, v);
      |     ~~~~~^~~~~~