Submission #671260

# Submission time Handle Problem Language Result Execution time Memory
671260 2022-12-12T14:48:33 Z mdn2002 Cop and Robber (BOI14_coprobber) C++14
0 / 100
1 ms 336 KB
#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 time Memory Grader output
1 Incorrect 0 ms 336 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 280 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB nextMove() returned a value that is either outside 0..N-1 or the new cop position is not a neighbour to the previous one
2 Halted 0 ms 0 KB -