Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. bool check(int S){
  2.     sliding_window w;
  3.     for(int sum = 2; sum <= n+m; ++sum){
  4.         int x = sum-S+2;
  5.         w.clear();
  6.         if(x<2) continue;
  7.         for(int r1 = 1; r1 <= min(n,sum-1); ++r1){
  8.             int r2 = sum-r1;
  9.             int len = r2-(x-r1)+1;
  10.             if(len<1) break;
  11.             //if(S==5) cout << sum << ": " << r1 << " " << r2 << " " << r1 << " " << x-r1 << " " << w.getmax() << endl;
  12.             if(r2<=m && a[r1]+b[r2]+hypotl(W,a[r1]-b[r2])-w.getmax()<=L) return true;
  13.             if(!(x-r1<=0)) w.push(d[x][r1]);
  14.             if(w.size()>len) w.pop();
  15.             if(r2<=m && a[r1]+b[r2]+hypotl(W,a[r1]-b[r2])-w.getmax()<=L) return true;
  16.         }
  17.     }
  18.     return false;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement