제출 #1130698

#제출 시각아이디문제언어결과실행 시간메모리
1130698mnbvcxz123경찰관과 강도 (BOI14_coprobber)C++20
컴파일 에러
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[2][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); stack<array<int,3>>tmp; for(int i=0;i<n;++i){ dp[1][i][i]=1; dp[0][i][i]=1; nxt[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]; }

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

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:22:15: error: incompatible types in assignment of 'int' to 'int [500][500]'
   22 |         nxt[i]=i;
      |         ~~~~~~^~
coprobber.cpp:23:13: error: 'class std::stack<std::array<int, 3> >' has no member named 'emplace_back'
   23 |         tmp.emplace_back(1,i,i);
      |             ^~~~~~~~~~~~
coprobber.cpp:24:13: error: 'class std::stack<std::array<int, 3> >' has no member named 'emplace_back'
   24 |         tmp.emplace_back(0,i,i);
      |             ^~~~~~~~~~~~
coprobber.cpp:27:24: error: no match for 'operator[]' (operand types are 'std::stack<std::array<int, 3> >' and 'int')
   27 |         auto[t,x,y]=tmp[it];
      |                        ^
coprobber.cpp:35:25: error: 'class std::stack<std::array<int, 3> >' has no member named 'push_back'
   35 |                     tmp.push_back({t^1,x,y2});
      |                         ^~~~~~~~~
coprobber.cpp:45:21: error: 'class std::stack<std::array<int, 3> >' has no member named 'push_back'
   45 |                 tmp.push_back({t^1,x2,y});
      |                     ^~~~~~~~~
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:59:29: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   59 |     return pos=nxt[pos][pos2];
      |                ~~~~~~~~~~~~~^
      |                             |
      |                             int*