# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1204013 | 12345678 | Cop and Robber (BOI14_coprobber) | C++17 | 171 ms | 327680 KiB |
#include "coprobber.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=505;
int in[nx], out[nx], pa[nx], t, cur;
vector<int> d[nx];
void dfs(int u, int p)
{
pa[u]=p;
in[u]=++t;
for (auto v:d[u]) if (v!=p) dfs(v, u);
out[u]=t;
}
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]) d[i].push_back(j), d[j].push_back(i);
dfs(0, 0);
return 0;
}
int nextMove(int R)
{
if (R==cur) return R;
for (auto v:d[cur]) if (v!=pa[cur]&&in[v]<=in[R]&&out[R]<=out[v]) return cur=v;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |