Submission #671257

# Submission time Handle Problem Language Result Execution time Memory
671257 2022-12-12T14:46:17 Z mdn2002 Cop and Robber (BOI14_coprobber) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
int n , a [502][502] , iswin [502][502][3];
int start(int n, bool a [502][502])
{
    for ( int i = 0 ; i < n ; i ++ )
    {
        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 );
}
*/














Compilation message

/usr/bin/ld: /tmp/ccU3LCu1.o: in function `main':
grader.cpp:(.text.startup+0x16c): undefined reference to `start(int, bool (*) [500])'
collect2: error: ld returned 1 exit status