Advertisement
Guest User

Untitled

a guest
Aug 20th, 2014
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. void rec( ll i, ll j, ll i2, ll j2, ll x, ll y, ll dx, ll dy ) {
  2.     for( ; x < n && y < m && x >= 0 && y >= 0 && b[x][y]; x += dx, y += dy ) {
  3.         if( dx == 1 && dy == 0 ) {
  4.             if( y + 1 < m && b[x][y + 1] && abs( i - x ) > 1 )
  5.                 rec( i, j, i, j, x, y, 0, 1 );  
  6.         } else if( dx == 0 && dy == 1 ) {
  7.             if( x - 1 >= 0 && b[x - 1][y] && abs( j - y ) > 1 )
  8.                 rec( i, j, x, y, x, y, -1, 0 );
  9.         } else if( dx == -1 && dy == 0 ) {
  10.             if( y - 1 >= 0 && b[x][y - 1] )
  11.                 rec( i, j, i2, j2, x, y, 0, -1 );
  12.         } else {
  13.             if( x == i && y == j && abs( i - i2 ) > 1 && abs( j - j2 ) > 1 ) {
  14.                 ans.pb( mp( mp( i, j ), mp( i2, j2 ) ) );
  15.                 s.pb( f( ans[ans.size() - 1], false ) );
  16.                 f( ans[ans.size() - 1], true );
  17.                 return;
  18.             }
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement