제출 #91280

#제출 시각아이디문제언어결과실행 시간메모리
91280Mohammad_Yasser경찰관과 강도 (BOI14_coprobber)C++14
0 / 100
2 ms384 KiB
#include "coprobber.h" #include <bits/stdc++.h> using namespace std; const int N = 505; vector<int> adj[N]; int nxt[N][N]; bool vis[N][N][2]; int losing_children[N][N]; int current = 0; void dfs(int cop, int robber, bool cop_turn) { if (vis[cop][robber][cop_turn]) { return; } vis[cop][robber][cop_turn] = true; if (cop_turn) { nxt[cop][robber] = cop; dfs(cop, robber, false); for (int v : adj[cop]) { nxt[v][robber] = cop; dfs(v, robber, false); } } else { for (int v : adj[robber]) { if (++losing_children[cop][v] == adj[v].size()) { dfs(cop, v, true); } } } } int start(int n, bool A[MAX_N][MAX_N]) { for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (A[i][j]) { adj[i].push_back(j); } } } for (int i = 0; i < n; ++i) { dfs(i, i, true); } for (int i = 0; i < n; ++i) { bool valid = true; for (int j = 0; j < n; ++j) { valid &= vis[i][j][false]; } if (valid) { current = i; return i; } } return -1; } int nextMove(int R) { current = nxt[current][R]; return current; }

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

coprobber.cpp: In function 'void dfs(int, int, bool)':
coprobber.cpp:30:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (++losing_children[cop][v] == adj[v].size()) {
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...