Submission #744274

# Submission time Handle Problem Language Result Execution time Memory
744274 2023-05-18T10:18:45 Z saayan007 Game (APIO22_game) C++17
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;

#define fr first
#define sc second
const char nl = '\n';
#include "game.h"

const int N = 301;
int n, k;
vector<vector<bool>> reach;
bitset<N> reach[N];
void init(int _n, int _k) {
    n = _n; k = _k;
    for(int i = 0; i < k - 1; ++i) {
        for(int j = i + 1; j < k; ++j) {
            reach[i][j] = 1;
        }
    }
}

int add_teleporter(int u, int v) {
    reach[u][v] = 1;
    reach[u] |= reach[v];
    for(int i = 0; i < n; ++i) {
        if(!reach[i][u]) continue;
        reach[i] |= reach[u];
    }

    for(int i = 0; i < k; ++i) if(reach[i][i]) return 1;
    return 0;
}

Compilation message

game.cpp:12:11: error: conflicting declaration 'std::bitset<301> reach [301]'
   12 | bitset<N> reach[N];
      |           ^~~~~
game.cpp:11:22: note: previous declaration as 'std::vector<std::vector<bool> > reach'
   11 | vector<vector<bool>> reach;
      |                      ^~~~~
game.cpp: In function 'int add_teleporter(int, int)':
game.cpp:24:14: error: no match for 'operator|=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'})
   24 |     reach[u] |= reach[v];
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from game.cpp:1:
/usr/include/c++/10/cstddef:160:3: note: candidate: 'constexpr std::byte& std::operator|=(std::byte&, std::byte)'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:160:20: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::byte&'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/10/ios:42,
                 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 game.cpp:1:
/usr/include/c++/10/bits/ios_base.h:99:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator|=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:99:29: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Fmtflags&'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:141:3: note: candidate: 'const std::_Ios_Openmode& std::operator|=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:141:29: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Openmode&'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:181:3: note: candidate: 'const std::_Ios_Iostate& std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:181:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Iostate&'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from game.cpp:1:
/usr/include/c++/10/future:167:18: note: candidate: 'std::launch& std::operator|=(std::launch&, std::launch)'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                  ^~~~~~~~
/usr/include/c++/10/future:167:37: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::launch&'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from game.cpp:1:
/usr/include/c++/10/charconv:680:3: note: candidate: 'constexpr std::chars_format& std::operator|=(std::chars_format&, std::chars_format)'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:680:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::chars_format&'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~
game.cpp:27:18: error: no match for 'operator|=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'})
   27 |         reach[i] |= reach[u];
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:45,
                 from game.cpp:1:
/usr/include/c++/10/cstddef:160:3: note: candidate: 'constexpr std::byte& std::operator|=(std::byte&, std::byte)'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/cstddef:160:20: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::byte&'
  160 |   operator|=(byte& __l, byte __r) noexcept
      |              ~~~~~~^~~
In file included from /usr/include/c++/10/ios:42,
                 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 game.cpp:1:
/usr/include/c++/10/bits/ios_base.h:99:3: note: candidate: 'const std::_Ios_Fmtflags& std::operator|=(std::_Ios_Fmtflags&, std::_Ios_Fmtflags)'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:99:29: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Fmtflags&'
   99 |   operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:141:3: note: candidate: 'const std::_Ios_Openmode& std::operator|=(std::_Ios_Openmode&, std::_Ios_Openmode)'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:141:29: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Openmode&'
  141 |   operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
      |              ~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/ios_base.h:181:3: note: candidate: 'const std::_Ios_Iostate& std::operator|=(std::_Ios_Iostate&, std::_Ios_Iostate)'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |   ^~~~~~~~
/usr/include/c++/10/bits/ios_base.h:181:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::_Ios_Iostate&'
  181 |   operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
      |              ~~~~~~~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:105,
                 from game.cpp:1:
/usr/include/c++/10/future:167:18: note: candidate: 'std::launch& std::operator|=(std::launch&, std::launch)'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                  ^~~~~~~~
/usr/include/c++/10/future:167:37: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::launch&'
  167 |   inline launch& operator|=(launch& __x, launch __y)
      |                             ~~~~~~~~^~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:127,
                 from game.cpp:1:
/usr/include/c++/10/charconv:680:3: note: candidate: 'constexpr std::chars_format& std::operator|=(std::chars_format&, std::chars_format)'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |   ^~~~~~~~
/usr/include/c++/10/charconv:680:28: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<bool> >, std::vector<bool> >::value_type' {aka 'std::vector<bool>'} to 'std::chars_format&'
  680 |   operator|=(chars_format& __lhs, chars_format __rhs) noexcept
      |              ~~~~~~~~~~~~~~^~~~~