제출 #785877

#제출 시각아이디문제언어결과실행 시간메모리
785877bane경찰관과 강도 (BOI14_coprobber)C++17
0 / 100
3041 ms4416 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...