제출 #768425

#제출 시각아이디문제언어결과실행 시간메모리
768425irmuunCop and Robber (BOI14_coprobber)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "coprobber.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(s) s.begin(),s.end() bool can[500][500][2];//0 robber, 1 cop int cnt[500][500]; int start(int N,bool a[500][500]){ vector<tuple<int,int,int>>v; for(int i=0;i<N;i++){ for(int j=0;j<N;j++){ can[i][j][0]=-1; can[i][j][1]=-1; } } for(int i=0;i<N;i++){ v.pb({i,i,0}); v.pb({i,i,1}); can[i][i][0]=true; can[i][i][1]=true; cnt[i][0]=0; for(int j=0;j<N;j++){ if(a[i][j]>0){ cnt[i][0]++; } } for(int j=1;j<N;j++){ cnt[i][j]=cnt[i][j-1]; } } for(int i=0;i<v.size();i++){ int x=get<0>(v[i]),y=get<1>(v[i]),c=get<2>(v[i]); if(c==0){ for(int j=0;j<N;j++){ if(a[j][y]>0){ cnt[x][j]--; if(cnt[x][j]==0){ can[x][j][1]=true; nxt[x][j]= v.pb({j,x,1}); } } } } else{ for(int j=0;j<N;j++){ if(a[x][j]>0){ cnt[j][y]--; if(cnt[j][y]==0){ can[j][y][1]=true; v.pb({j,x,1}); } } } } } } int nextMove(int r){ if(f==0){ dfs(0); f=1; } if(p[r]==cur){ return cur; } while(p[r]!=cur){ r=p[r]; } return cur=r; }

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

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:37:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for(int i=0;i<v.size();i++){
      |                 ~^~~~~~~~~
coprobber.cpp:45:25: error: 'nxt' was not declared in this scope
   45 |                         nxt[x][j]=
      |                         ^~~
coprobber.cpp:63:1: warning: no return statement in function returning non-void [-Wreturn-type]
   63 | }
      | ^
coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:66:8: error: 'f' was not declared in this scope
   66 |     if(f==0){
      |        ^
coprobber.cpp:67:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   67 |         dfs(0);
      |         ^~~
      |         ffs
coprobber.cpp:70:8: error: 'p' was not declared in this scope
   70 |     if(p[r]==cur){
      |        ^
coprobber.cpp:70:14: error: 'cur' was not declared in this scope
   70 |     if(p[r]==cur){
      |              ^~~
coprobber.cpp:73:11: error: 'p' was not declared in this scope
   73 |     while(p[r]!=cur){
      |           ^
coprobber.cpp:73:17: error: 'cur' was not declared in this scope
   73 |     while(p[r]!=cur){
      |                 ^~~
coprobber.cpp:76:12: error: 'cur' was not declared in this scope
   76 |     return cur=r;
      |            ^~~