답안 #697440

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
697440 2023-02-09T19:55:53 Z Deepesson 경찰관과 강도 (BOI14_coprobber) C++17
0 / 100
1 ms 336 KB
#include <bits/stdc++.h>

using namespace std;

#define MAX_N 500

// modify the following functions
// you can define global variables and functions
std::vector<int> con[MAX_N];
int start(int N, bool A[MAX_N][MAX_N]) {
    int count=0;
    for(int i=0;i!=N;++i){
        for(int j=0;j!=N;++j){
            if(i==j)continue;
            if(A[i][j])
            con[i].push_back(j);
        }
    }
    return 0;
}
int obj=0;
int dfs(int pos,int prev=-1){
    if(pos==obj){
        return pos;
    }
    for(auto&x:con[pos]){
        if(x==prev)continue;
        if(dfs(x,pos)){
            return x;
        }
    }
    return -1;
}
int atual=0;
int nextMove(int R) {
    obj=R;
    int strat = dfs(atual);
    assert(strat!=-1);
    return atual=strat;
}

Compilation message

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:11:9: warning: unused variable 'count' [-Wunused-variable]
   11 |     int count=0;
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 1 ms 336 KB the situation repeated
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 336 KB the situation repeated
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 0 ms 336 KB the situation repeated
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Incorrect 1 ms 336 KB the situation repeated
4 Halted 0 ms 0 KB -