제출 #841917

#제출 시각아이디문제언어결과실행 시간메모리
841917manizare경찰관과 강도 (BOI14_coprobber)C++14
100 / 100
326 ms5860 KiB
#include<bits/stdc++.h> #include "coprobber.h" using namespace std; #define pb push_back #define ll long long #define F first #define S second #define all(s) s.begin(),s.end() const int maxn = 502 ; bool mark[maxn][maxn][2] , c[500][500] ; int nxt[maxn][maxn] , cur = 0 ,ted[maxn][maxn] ; vector <int> G[maxn] ; void dfs(int vi , int vj , int k){ mark[vi][vj][k] = 1; if(k == 1){ if(mark[vi][vj][0]==0){ nxt[vi][vj] = vi ; dfs(vi , vj , 0) ; } for(int i =0 ; i < G[vi].size() ; i++){ int u = G[vi][i] ; if(mark[u][vj][0] == 0){ nxt[u][vj] = vi ; dfs(u , vj , 0) ; } } }else{ for(int i =0 ; i < G[vj].size() ; i++){ int u = G[vj][i] ; if(mark[vi][u][1] == 0){ ted[vi][u]--; if(ted[vi][u] == 0){ dfs(vi , u , 1) ; } } } } } int start(int n , bool a[500][500]){ for(int i =0 ; i < n ; i++){ for(int j = 0 ; j < n ; j++){ if(a[i][j] == 1){ G[i].pb(j) ; } } } for(int i =0 ; i < n ; i++){ for(int j= 0 ; j < n ; j++){ ted[i][j] = G[j].size() ; } } for(int i = 0 ; i < n ; i++){ if(mark[i][i][0] == 0) dfs(i , i , 0) ; if(mark[i][i][1] == 0) dfs(i , i , 1); } cur = -1 ; for(int i = 0 ; i < n ; i++){ bool ok =1 ; for(int j =0 ; j < n ; j++){ if(mark[i][j][0] == 0)ok =0 ; } if(ok == 1){ cur = i ; break ; } } return cur ; } int nextMove(int r){ cur = nxt[cur][r] ; return cur ; }

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

coprobber.cpp: In function 'void dfs(int, int, int)':
coprobber.cpp:23:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for(int i =0 ; i < G[vi].size() ; i++){
      |                    ~~^~~~~~~~~~~~~~
coprobber.cpp:31:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for(int i =0 ; i < G[vj].size() ; i++){
      |                    ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...