Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void rec( ll i, ll j, ll i2, ll j2, ll x, ll y, ll dx, ll dy ) {
- for( ; x < n && y < m && x >= 0 && y >= 0 && b[x][y]; x += dx, y += dy ) {
- if( dx == 1 && dy == 0 ) {
- if( y + 1 < m && b[x][y + 1] && abs( i - x ) > 1 )
- rec( i, j, i, j, x, y, 0, 1 );
- } else if( dx == 0 && dy == 1 ) {
- if( x - 1 >= 0 && b[x - 1][y] && abs( j - y ) > 1 )
- rec( i, j, x, y, x, y, -1, 0 );
- } else if( dx == -1 && dy == 0 ) {
- if( y - 1 >= 0 && b[x][y - 1] )
- rec( i, j, i2, j2, x, y, 0, -1 );
- } else {
- if( x == i && y == j && abs( i - i2 ) > 1 && abs( j - j2 ) > 1 ) {
- ans.pb( mp( mp( i, j ), mp( i2, j2 ) ) );
- s.pb( f( ans[ans.size() - 1], false ) );
- f( ans[ans.size() - 1], true );
- return;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement