Submission #1296741

#TimeUsernameProblemLanguageResultExecution timeMemory
1296741M_W_13Game (IOI14_game)C++20
Compilation error
0 ms0 KiB
#include "game.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define st first
#define nd second
#define pb push_back
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
const int MAXN = 1507;
int ojc[MAXN];
int ile[MAXN];

int. find(int v) {
    if (ojc[v] == v) return v;
    int pom = find(ojc[v]);
    ojc[v] = pom;
    return pom;
}

void Union(int a, int b) {
    int u = find(a);
    int w = find(b);
    ojc[u] = w;
    ile[w] += ile[u];
}

void initialize(int n) {
    rep(i, n + 1) {
        ojc[i] = i;
        ile[i] = n - 1;
    }
}

int hasEdge(int u, int v) {
    int a = find(u);
    int b = find(v);
    ile[a]--;
    ile[b]--;
    if (ile[a] == 0 || ile[b] == 0) {
        Union(a, b);
        return 1;
    }
    return 0;
}

Compilation message (stderr)

game.cpp:16:4: error: expected unqualified-id before '.' token
   16 | int. find(int v) {
      |    ^
game.cpp: In function 'void Union(int, int)':
game.cpp:24:17: error: no matching function for call to 'find(int&)'
   24 |     int u = find(a);
      |             ~~~~^~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from game.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:3889:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3889 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note:   template argument deduction/substitution failed:
game.cpp:24:17: note:   candidate expects 3 arguments, 1 provided
   24 |     int u = find(a);
      |             ~~~~^~~
In file included from /usr/include/c++/13/algorithm:73:
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
game.cpp:24:17: note:   candidate expects 4 arguments, 1 provided
   24 |     int u = find(a);
      |             ~~~~^~~
In file included from /usr/include/c++/13/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:54:
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
game.cpp:24:17: note:   mismatched types 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >' and 'int'
   24 |     int u = find(a);
      |             ~~~~^~~
game.cpp:25:17: error: no matching function for call to 'find(int&)'
   25 |     int w = find(b);
      |             ~~~~^~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3889 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note:   template argument deduction/substitution failed:
game.cpp:25:17: note:   candidate expects 3 arguments, 1 provided
   25 |     int w = find(b);
      |             ~~~~^~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
game.cpp:25:17: note:   candidate expects 4 arguments, 1 provided
   25 |     int w = find(b);
      |             ~~~~^~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
game.cpp:25:17: note:   mismatched types 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >' and 'int'
   25 |     int w = find(b);
      |             ~~~~^~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:38:17: error: no matching function for call to 'find(int&)'
   38 |     int a = find(u);
      |             ~~~~^~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3889 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note:   template argument deduction/substitution failed:
game.cpp:38:17: note:   candidate expects 3 arguments, 1 provided
   38 |     int a = find(u);
      |             ~~~~^~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
game.cpp:38:17: note:   candidate expects 4 arguments, 1 provided
   38 |     int a = find(u);
      |             ~~~~^~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
game.cpp:38:17: note:   mismatched types 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >' and 'int'
   38 |     int a = find(u);
      |             ~~~~^~~
game.cpp:39:17: error: no matching function for call to 'find(int&)'
   39 |     int b = find(v);
      |             ~~~~^~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note: candidate: 'template<class _IIter, class _Tp> constexpr _IIter std::find(_IIter, _IIter, const _Tp&)'
 3889 |     find(_InputIterator __first, _InputIterator __last,
      |     ^~~~
/usr/include/c++/13/bits/stl_algo.h:3889:5: note:   template argument deduction/substitution failed:
game.cpp:39:17: note:   candidate expects 3 arguments, 1 provided
   39 |     int b = find(v);
      |             ~~~~^~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::find(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
   60 | find(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~
/usr/include/c++/13/pstl/glue_algorithm_defs.h:60:1: note:   template argument deduction/substitution failed:
game.cpp:39:17: note:   candidate expects 4 arguments, 1 provided
   39 |     int b = find(v);
      |             ~~~~^~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/13/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
game.cpp:39:17: note:   mismatched types 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >' and 'int'
   39 |     int b = find(v);
      |             ~~~~^~~