This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define MAX_N 500
using namespace std;
vector<int> grafo[MAX_N];
int dist[MAX_N], pai[MAX_N];
void dfs(int u, int p=0) {
pai[u] = p;
for(auto v : grafo[u]) {
if(v == p) continue;
dist[v] = dist[u] + 1;
dfs(v, u);
}
}
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]) grafo[i].push_back(j);
}
}
dfs(0);
return 0;
}
int nextMove(int R) {
int p = R;
while(pai[p] != 0)
p = pai[p];
nextMove(p);
return 0;
}
// don't modify the main function
// int main() {
// int N;
// cin >> N;
// bool A[MAX_N][MAX_N];
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < N; j++) {
// cin >> A[i][j];
// }
// }
// int P = start(N,A);
// cout << P << endl;
// int R;
// cin >> R;
// while (true) {
// if (P == R) break;
// P = nextMove(R);
// cout << P << endl;
// if (P == R) break;
// cin >> R;
// }
// }
# | 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... |