#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 210;
int n, m;
int lineXor[MAXN];
int columnXor[MAXN];
int lineConsecutiveAnd[MAXN];
int columnConsecutiveAnd[MAXN];
int getCell(int i, int j) { return i*m + j; }
void construct_network(int H, int W, int K)
{
n = H; m = W;
for(int i = 0 ; i < n ; i++)
{
vector< int > q;
for(int j = 0 ; j < m ; j++)
q.push_back( getCell( i , j ) );
lineXor[i] = add_xor( q );
}
vector< int > aux;
for(int i = 0 ; i < n ; i++)
aux.push_back( lineXor[i] );
int orLine = add_or( aux );
for(int j = 0 ; j < m ; j++)
{
vector< int > q;
for(int i = 0 ; i < n ; i++)
q.push_back( getCell( i , j ) );
columnXor[j] = add_xor( q );
}
aux.clear();
for(int i = 0 ; i < m ; i++)
aux.push_back( columnXor[i] );
int orColumn = add_or( aux );
for(int i = 0 ; i < n - 1 ; i++)
{
aux.clear();
aux.push_back( lineXor[i] );
aux.push_back( lineXor[i + 1] );
lineConsecutiveAnd[i] = add_and( aux );
}
for(int i = 0 ; i < m - 1 ; i++)
{
aux.clear();
aux.push_back( columnXor[i] );
aux.push_back( columnXor[i + 1] );
columnConsecutiveAnd[i] = add_and( aux );
}
//orLine^orColumn == 1
aux.clear();
for(int i = 0 ; i < n - 1 ; i++)
aux.push_back( lineConsecutiveAnd[i] );
for(int i = 0 ; i < m - 1 ; i++)
aux.push_back( columnConsecutiveAnd[i] );
int hasAdjacent = add_or( aux );
aux.clear();
aux.push_back( orLine );
aux.push_back( orColumn );
int x = add_xor( aux );
aux.clear();
aux.push_back( x );
aux.push_back( hasAdjacent );
add_and( aux );
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
376 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
1120 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
6 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
11 ms |
760 KB |
Output is correct |
8 |
Correct |
10 ms |
748 KB |
Output is correct |
9 |
Correct |
15 ms |
1144 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
380 KB |
Output is correct |
2 |
Incorrect |
5 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |