#include "vision.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
void construct_network ( int H, int W, int K )
{
vi rows, cols, ind, auxrow, auxcol, fin;
for ( int i = 0; i < H; i++ )
{
ind.clear();
for ( int j = 0; j < W; j++ )
ind.push_back ( i * W + j );
rows.push_back ( add_or ( ind ) );
}
for ( int j = 0; j < W; j++ )
{
ind.clear();
for ( int i = 0; i < H; i++ )
ind.push_back ( i * W + j );
cols.push_back ( add_or ( ind ) );
}
fin.clear();
auxrow.clear();
for ( int x = 0; x + K < H; x++ )
{
ind.clear();
ind.push_back ( rows[x] );
ind.push_back ( rows[x + K] );
auxrow.push_back ( add_and ( ind ) );
}
if ( !auxrow.empty() )
fin.push_back ( add_or ( auxrow ) );
auxcol.clear();
for ( int x = 0; x + K < W; x++ )
{
ind.clear();
ind.push_back ( cols[x] );
ind.push_back ( cols[x + K] );
auxcol.push_back ( add_and ( ind ) );
}
if ( !auxcol.empty() )
fin.push_back ( add_or ( auxcol ) );
for ( int i = 1; i < K; i++ )
{
if ( i < H && K - i < W )
{
auxrow.clear(), auxcol.clear();
for ( int x = 0; x + i < H; x++ )
{
ind.clear();
ind.push_back ( rows[x] );
ind.push_back ( rows[x + i] );
auxrow.push_back ( add_and ( ind ) );
}
for ( int x = 0; x + K - i < W; x++ )
{
ind.clear();
ind.push_back ( cols[x] );
ind.push_back ( cols[x + K - i] );
auxcol.push_back ( add_and ( ind ) );
}
ind.clear();
ind.push_back ( add_or ( auxrow ) );
ind.push_back ( add_or ( auxcol ) );
fin.push_back ( add_and ( ind ) );
}
}
add_or ( fin );
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
376 KB |
Output is correct |
11 |
Correct |
2 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
376 KB |
Output is correct |
13 |
Correct |
2 ms |
376 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
3 ms |
376 KB |
Output is correct |
16 |
Correct |
2 ms |
376 KB |
Output is correct |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Correct |
2 ms |
376 KB |
Output is correct |
19 |
Correct |
2 ms |
376 KB |
Output is correct |
20 |
Correct |
2 ms |
376 KB |
Output is correct |
21 |
Correct |
2 ms |
376 KB |
Output is correct |
22 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
on inputs (0, 0), (1, 1), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
1144 KB |
on inputs (57, 107), (59, 108), expected 0, but computed 1 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Incorrect |
2 ms |
256 KB |
on inputs (0, 1), (1, 0), expected 0, but computed 1 |
6 |
Halted |
0 ms |
0 KB |
- |