#include <bits/stdc++.h>
using namespace std;
//subtask 1
vector<vector<int>> adj(500, vector<int>(500));
vector<int> p(500);
int cop = 0;
void dfs(int actual, int anterior){
p[actual] = anterior;
for (auto it: adj[actual]){
if (it != anterior){
dfs(it, actual);
}
}
}
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){
adj[i].push_back(j);
}
}
}
dfs(0, -1);
return 0;
}
int nextMove(int r){
if (r == cop) return r;
else{
while (cop != p[r]){
r = p[r];
}
}
cop = r;
return r;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1232 KB |
Output is correct |
2 |
Correct |
2 ms |
1232 KB |
Output is correct |
3 |
Runtime error |
1149 ms |
262144 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1090 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1232 KB |
Output is correct |
2 |
Correct |
2 ms |
1232 KB |
Output is correct |
3 |
Runtime error |
1093 ms |
262144 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1232 KB |
Output is correct |
2 |
Correct |
2 ms |
1232 KB |
Output is correct |
3 |
Runtime error |
1149 ms |
262144 KB |
Execution killed with signal 9 |
4 |
Halted |
0 ms |
0 KB |
- |