Submission #1130700

#TimeUsernameProblemLanguageResultExecution timeMemory
1130700mnbvcxz123Cop and Robber (BOI14_coprobber)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
using ll=long long;

constexpr int N=500;

int n;
int dp[2][N][N],cnt[2][N][N],nxt[N][N];
int pos=0;
vector<int>g[N];

int start(int _N, bool _A[N][N]){
    n=_N;
    for(int i=0;i<n;++i)
        for(int j=0;j<n;++j)
            if(_A[i][j])
                g[i].push_back(j);
    vector<array<int,3>>tmp;
    for(int i=0;i<n;++i){
        dp[1][i][i]=1;
        dp[0][i][i]=1;
        nxt[i][i]=i;
        tmp.emplace_back(1,i,i);
        tmp.emplace_back(0,i,i);
    }
    for(int it=0;it<tmp.size();++it){
        auto[t,x,y]=tmp[it];
        if(t==0){
            auto var=g[y];
            for(auto y2:var){
                if(dp[t^1][x][y2])continue;
                ++cnt[t^1][x][y2];
                if(cnt[t^1][x][y2]==(int)g[y2].size()){
                    dp[t^1][x][y2]=1;
                    tmp.push_back({t^1,x,y2});
                }
            }
        }else{
            auto var=g[x];
            var.push_back(x);
            for(auto x2:var){
                if(dp[t^1][x2][y])continue;
                nxt[x2][y]=x;
                dp[t^1][x2][y]=1;
                tmp.push_back({t^1,x2,y});
            }
        }
    }
    for(int i=0;i<n;++i){
        int win=0;
        for(int j=0;j<n;++j)
            if(dp[0][i][j]==1)++win;
        if(win==n)return pos=i;
    }
    return -1;
}

int nextMove(int pos2){
    return pos=nxt[pos][pos2];
}

Compilation message (stderr)

In file included from /usr/include/c++/11/ext/alloc_traits.h:34,
                 from /usr/include/c++/11/bits/basic_string.h:40,
                 from /usr/include/c++/11/string:55,
                 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 coprobber.cpp:1:
/usr/include/c++/11/bits/alloc_traits.h: In instantiation of 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 3>; _Args = {int, int&, int&}; _Tp = std::array<int, 3>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::array<int, 3> >]':
/usr/include/c++/11/bits/vector.tcc:115:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int&, int&}; _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::vector<_Tp, _Alloc>::reference = std::array<int, 3>&]'
coprobber.cpp:23:25:   required from here
/usr/include/c++/11/bits/alloc_traits.h:518:28: error: no matching function for call to 'construct_at(std::array<int, 3>*&, int, int&, int&)'
  518 |           std::construct_at(__p, std::forward<_Args>(__args)...);
      |           ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/stl_iterator.h:85,
                 from /usr/include/c++/11/bits/stl_algobase.h:67,
                 from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from coprobber.cpp:1:
/usr/include/c++/11/bits/stl_construct.h:94:5: note: candidate: 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)'
   94 |     construct_at(_Tp* __location, _Args&&... __args)
      |     ^~~~~~~~~~~~
/usr/include/c++/11/bits/stl_construct.h:94:5: note:   template argument deduction/substitution failed:
/usr/include/c++/11/bits/stl_construct.h: In substitution of 'template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = std::array<int, 3>; _Args = {int, int&, int&}]':
/usr/include/c++/11/bits/alloc_traits.h:518:21:   required from 'static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<int, 3>; _Args = {int, int&, int&}; _Tp = std::array<int, 3>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::array<int, 3> >]'
/usr/include/c++/11/bits/vector.tcc:115:30:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int&, int&}; _Tp = std::array<int, 3>; _Alloc = std::allocator<std::array<int, 3> >; std::vector<_Tp, _Alloc>::reference = std::array<int, 3>&]'
coprobber.cpp:23:25:   required from here
/usr/include/c++/11/bits/stl_construct.h:96:17: error: array must be initialized with a brace-enclosed initializer
   96 |     -> decltype(::new((void*)0) _Tp(std::declval<_Args>()...))
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~