Submission #1053114

#TimeUsernameProblemLanguageResultExecution timeMemory
1053114kachim2Cop and Robber (BOI14_coprobber)C++17
16 / 100
26 ms1716 KiB
#include "coprobber.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
int start(int N, bool A[MAX_N][MAX_N])
{
    graph.resize(N);
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            if(A[i][j]) graph[i].push_back(j);
        }
    }
    return 0;
}
int cpos = 0;
bool dfs(int r, int v, int p){
    if(v==r) return true;
    for(auto i : graph[v]){
        if(i!=p)
        if(dfs(r, i, v)) return true;
    }
    return false;
}
int nextMove(int R)
{
    for(auto i : graph[cpos]){
        if(dfs(R, i, cpos)){
            cpos = i;
            return i;
        }
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...