Submission #671260

#TimeUsernameProblemLanguageResultExecution timeMemory
671260mdn2002Cop and Robber (BOI14_coprobber)C++14
0 / 100
1 ms336 KiB
#include<bits/stdc++.h> using namespace std; int n , a [502][502] , iswin [502][502][3]; int start(int N, bool A [500][500]) { n = N; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) a [i][j] = A [i][j]; iswin [i][i][0] = 1; iswin [i][i][1] = 1; } while ( true ) { int did = 0; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { for ( int z = 0 ; z < 2 ; z ++ ) { if ( iswin [i][j][z] ) continue; int num = 0 , all = 0; for ( int k = 0 ; k < n ; k ++ ) { int nx = i , ny = j , can = 0 , zz = z ^ 1; if ( zz == 0 ) { ny = k; if ( a [j][k] ) can = 1; } else { nx = k; if ( a [i][k] ) can = 1; } if ( zz == 1 && i == k ) can = 1; if ( can == 0 ) continue; all ++; if ( iswin [nx][ny][zz] ) num ++; } if ( ( z == 1 && all == num ) || ( z == 0 && num ) ) { iswin [i][j][z] = 1; did = 1; } } } } if ( did == 0 ) break; } for ( int i = 0 ; i < n ; i ++ ) { int num = 0; for ( int j = 0 ; j < n ; j ++ ) { if ( iswin [i][j][0] ) num ++; } if ( num == n ) return i; } return -1; } int nextMove(int R) { return -1; } /* int main() { cin >> n; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) cin >> a [i][j]; } start ( n , a ); } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...