#include "vision.h"
#include <bits/stdc++.h>
using namespace std ;
int cnt ;
vector <int> Ns;
int pos1 = 0, pos2 = 0, var ;
void ini() {
Ns = vector<int>() ;
}
int goDiagonal ( int fil, int col, int H, int W ) {
while ( fil >= 0 && col < W ) {
if ( fil >= H || col < 0 ) {}
else
Ns.push_back ( fil*W+col ) ;
fil-- ;
col++ ;
}
}
int otDiag ( int fil, int col, int H, int W ) {
while ( fil >= 0 && col >= 0 ) {
if ( fil >= H || col >= W ) {}
else
Ns.push_back ( fil*W+col ) ;
fil-- ;
col-- ;
}
}
int diagDer ( int H, int W, int K ) {
ini() ;
goDiagonal(H-1, W-K-2, H, W) ;
if ( Ns.size() ) {
add_or( Ns ) ;
ini() ;
goDiagonal(H-1, W-1, H, W );
add_or ( Ns ) ;
add_and(vector<int>{cnt, cnt+1}) ;
cnt+=3 ;
}
for ( int i = W-K-3 ; i >= -H ; --i ) {
ini() ;
goDiagonal ( H-1, i, H, W ) ;
add_or ( Ns ) ;
ini() ;
goDiagonal ( H-1, i+K+1, H, W ) ;
Ns.push_back ( cnt-2 ) ;
add_or ( Ns ) ;
add_and(vector<int>{cnt, cnt+1}) ;
cnt+=3 ;
}
}
int diagIzq ( int H, int W, int K ) {
ini() ;
otDiag ( H-1, W+H-K-2, H, W ) ;
if ( Ns.size() ) {
add_or( Ns ) ;
ini() ;
goDiagonal(H-1, W+H-1, H, W );
add_or ( Ns ) ;
add_and(vector<int>{cnt, cnt+1}) ;
cnt+=3 ;
}
for ( int i = W+H-K-3 ; i >= 0 ; --i ) {
ini() ;
goDiagonal ( H-1, i, H, W ) ;
add_or ( Ns ) ;
ini() ;
goDiagonal ( H-1, i+K+1, H, W ) ;
Ns.push_back ( cnt-2 ) ;
add_or ( Ns ) ;
add_and(vector<int>{cnt, cnt+1}) ;
cnt+=3 ;
}
}
void solve ( int H, int W, int K, int flag ) {
diagDer ( H, W, K ) ;
diagIzq ( H, W, K ) ;
vector <int> frOr ;
int cur = 0 ;
vector <int> xorAdd ;
for ( int i = 0 ; i < H ; ++i ) {
for ( int j = 0 ; j < W ;++j ) xorAdd.push_back(i*W+j) ;
}
add_xor(xorAdd) ;
add_xor(xorAdd) ;
add_xor(xorAdd) ;
cnt+=3 ;
for ( int i = var ; i < cnt ; ++i ) {
if ( cur==2 ) frOr.push_back ( i );
cur++ ;
cur%=3 ;
}
add_or ( frOr ) ;
if ( flag ) pos1 = cnt ;
else pos2 = cnt ;
cnt++ ;
var = cnt ;
}
void construct_network(int H, int W, int K) {
var = cnt = H*W ;
solve ( H, W, K, 1 ) ;
solve ( H, W, K-1, 0 ) ;
add_xor ( vector <int>{pos1,pos2} ) ;
}
Compilation message
vision.cpp: In function 'int goDiagonal(int, int, int, int)':
vision.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
vision.cpp: In function 'int otDiag(int, int, int, int)':
vision.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
vision.cpp: In function 'int diagDer(int, int, int)':
vision.cpp:55:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
vision.cpp: In function 'int diagIzq(int, int, int)':
vision.cpp:79:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
436 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
732 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: Instruction with no inputs |
2 |
Halted |
0 ms |
0 KB |
- |