제출 #974808

#제출 시각아이디문제언어결과실행 시간메모리
974808MilosMilutinovic경찰관과 강도 (BOI14_coprobber)C++14
0 / 100
40 ms4120 KiB
#include "coprobber.h" #include <bits/stdc++.h> using namespace std; const int N = 505; int cur; bool dp[N][N][2]; vector<int> g[N]; int deg[N][N][2]; int start(int n, bool A[MAX_N][MAX_N]) { for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (!A[i][j]) { continue; } g[i].push_back(j); g[j].push_back(i); } } vector<array<int, 3>> que; for (int i = 0; i < n; i++) { dp[i][i][0] = true; dp[i][i][1] = true; que.push_back({i, i, 0}); que.push_back({i, i, 1}); } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { deg[i][j][1] = (int) g[j].size(); } } for (int b = 0; b < (int) que.size(); b++) { int i = que[b][0]; int j = que[b][1]; int t = que[b][2]; if (t == 0) { for (int k : g[j]) { deg[i][k][1]--; if (deg[i][k][1] <= 0 && !dp[i][k][1]) { dp[i][k][1] = true; que.push_back({i, k, 1}); } } } else { for (int k : g[i]) { if (!dp[k][j][0]) { dp[k][j][0] = true; que.push_back({i, k, 1}); } } } } cur = -1; for (int i = 0; i < n; i++) { bool ok = true; for (int j = 0; j < n; j++) { if (!dp[i][j][0]) { ok = false; } } if (ok) { cur = i; break; } } return cur; } int nextMove(int r) { for (int i : g[cur]) { if (dp[i][r][1]) { cur = i; return i; } } }

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

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
   79 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...