#include<bits/stdc++.h>
using namespace std;
int n , iswin [502][502][3] , nxt [502][502][3] , cnt [502][502] , cur;
bool a [500][500];
int start(int N, bool A [500][500])
{
memset ( nxt , -1 , sizeof nxt );
n = N;
vector < pair < pair < int , int > , int > > v;
for ( int i = 0 ; i < n ; i ++ )
{
int cntt = 0;
for ( int j = 0 ; j < n ; j ++ )
{
cntt += A [i][j];
a [i][j] = A [i][j];
}
for ( int j = 0 ; j < n ; j ++ ) cnt [j][i] = cntt;
iswin [i][i][0] = 1;
iswin [i][i][1] = 1;
v . push_back ( { { i , i } , 0 } );
v . push_back ( { { i , i } , 1 } );
}
while ( v . size () )
{
int did = 0;
pair < pair < int , int > , int > p = * -- v . end ();
v . pop_back ();
int i = p . first . first , j = p . first . second , z = p . second;
for ( int k = 0 ; k < n ; k ++ )
{
int nx = i , ny = j , can = 0 , zz = z ^ 1;
if ( zz == 1 )
{
ny = k;
if ( a [j][k] ) can = 1;
}
else
{
nx = k;
if ( a [i][k] ) can = 1;
}
if ( zz == 0 && i == k ) can = 1;
if ( can == 0 || iswin [nx][ny][zz] ) continue;
if ( zz == 0 )
{
iswin [nx][ny][zz] = 1;
nxt [nx][ny][zz] = i;
v . push_back ( { { nx , ny } , zz } );
}
else
{
cnt [nx][ny] --;
if ( cnt [nx][ny] == 0 )
{
nxt [nx][ny][zz] = j;
iswin [nx][ny][zz] = 1;
v . push_back ( { { nx , ny } , zz } );
}
}
}
}
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 )
{
cur = i;
return i;
}
}
return -1;
}
int nextMove(int R) {
return -1;
}
Compilation message
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:27:13: warning: unused variable 'did' [-Wunused-variable]
27 | int did = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
3280 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 |
2 ms |
3280 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 |
3280 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 |
3280 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 |
- |