#include <bits/stdc++.h>
using namespace std ;
#define pb push_back
typedef vector < int > vi ;
#include "vision.h"
int n , m ;
vi R , C , last ;
int f ( int i , int j ) {
return i * m + j ;
}
void solve1 () {
vi Ret ;
Ret .pb ( add_xor ( R ) ) ;
Ret .pb ( add_xor ( C ) ) ;
Ret .pb ( add_and ( { add_or ( R ) , add_or ( C ) } ) ) ;
vi AdjOnes ;
for ( int i = 0 ; i < n - 1 ; i ++ ) {
vi crnt ;
for ( int j = 0 ; j < n ; j ++ ) {
if ( j == i || j == i + 1 ) continue ;
crnt .pb ( R [j] ) ;
}
crnt .pb ( add_not ( add_or ( { R [i] , R [i+1] } ) ) ) ;
AdjOnes .pb ( add_or ( crnt ) ) ;
}
Ret .pb ( add_and ( AdjOnes ) ) ;
last .pb ( add_not ( add_or ( Ret ) ) ) ;
}
void solve2 () {
vi Ret ;
Ret .pb ( add_xor ( R ) ) ;
Ret .pb ( add_xor ( C ) ) ;
Ret .pb ( add_and ( { add_or ( R ) , add_or ( C ) } ) ) ;
vi AdjOnes ;
for ( int i = 0 ; i < m - 1 ; i ++ ) {
vi crnt ;
for ( int j = 0 ; j < m ; j ++ ) {
if ( j == i || j == i + 1 ) continue ;
crnt .pb ( C [j] ) ;
}
crnt .pb ( add_not ( add_or ( { C [i] , C [i+1] } ) ) ) ;
AdjOnes .pb ( add_or ( crnt ) ) ;
}
Ret .pb ( add_and ( AdjOnes ) ) ;
last .pb ( add_not ( add_or ( Ret ) ) ) ;
}
void construct_network ( int H , int W , int K ) {
if ( H == 1 ) {
vi v ;
for ( int i = K ; i < W ; i ++ ) {
v .pb ( add_and ( { i - K , i } ) ) ;
}
add_or ( v ) ;
return ;
}
if ( W == 1 ) {
vi v ;
for ( int i = K ; i < H ; i ++ ) {
v .pb ( add_and ( { i - K , i } ) ) ;
}
add_or ( v ) ;
return ;
}
n = H , m = W ;
for ( int i = 0 ; i < n ; i ++ ) {
vi ret ;
for ( int j = 0 ; j < m ; j ++ ) {
ret .pb ( f ( i , j ) ) ;
}
R .pb ( add_xor ( ret ) ) ;
}
for ( int j = 0 ; j < m ; j ++ ) {
vi ret ;
for ( int i = 0 ; i < n ; i ++ ) {
ret .pb ( f ( i , j ) ) ;
}
C .pb ( add_xor ( ret ) ) ;
}
solve1 () ;
solve2 () ;
add_or ( last ) ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
256 KB |
Output is correct |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
256 KB |
Output is correct |
14 |
Correct |
1 ms |
256 KB |
Output is correct |
15 |
Correct |
1 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Correct |
1 ms |
256 KB |
Output is correct |
18 |
Correct |
1 ms |
256 KB |
Output is correct |
19 |
Correct |
1 ms |
256 KB |
Output is correct |
20 |
Correct |
1 ms |
256 KB |
Output is correct |
21 |
Correct |
1 ms |
256 KB |
Output is correct |
22 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
1 ms |
288 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1972 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
3 ms |
512 KB |
Output is correct |
4 |
Correct |
7 ms |
640 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
13 ms |
1280 KB |
Output is correct |
8 |
Correct |
13 ms |
1336 KB |
Output is correct |
9 |
Correct |
21 ms |
2048 KB |
Output is correct |
10 |
Correct |
1 ms |
256 KB |
Output is correct |
11 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Incorrect |
1 ms |
256 KB |
on inputs (0, 0), (0, 1), expected 0, but computed 1 |
7 |
Halted |
0 ms |
0 KB |
- |