이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "coprobber.h"
#include<bits/stdc++.h>
using namespace std;
int win[MAX_N][MAX_N][2];
int go[MAX_N][MAX_N];
int cop;
int start(int N, bool A[MAX_N][MAX_N])
{
memset(win, 0, sizeof(win));
memset(go, 0, sizeof(go));
for (int timer = 0; timer < N; timer++){
for (int i = 0; i < N; i++){
for (int j = 0; j < N; j++){
//ako sme na ista pozicija, pobeda
if (i == j){
win[i][j][0] = 1;
win[i][j][1] = 1;
go[i][j] = i;
continue;
}
//nie sme na poteg
bool forced_pobeda = 0;
for (int k = 0; k < N; k++){
if (A[i][k]){
if (win[k][j][1]) go[i][j] = k;
forced_pobeda |= win[k][j][1];
}
}
win[i][j][0] = forced_pobeda;
//toj e na poteg
forced_pobeda = 1;
for (int k = 0; k < N; k++){
if (A[j][k]){
forced_pobeda &= win[i][k][0];
}
}
win[i][j][1] = forced_pobeda;
}
}
}
for (int starting = 0; starting < N; starting++){
bool forced = 1;
for (int j = 0; j < N; j++){
forced &= win[starting][j][0];
}
if (forced){
cop = starting;
return starting;
}
}
return -1;
}
int nextMove(int R)
{
cop = go[cop][R];
return cop;;
}
# | 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... |