Guest User

Untitled

a guest
Dec 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <sstream>
  4. #include <queue>
  5. using namespace std;
  6.  
  7.  
  8. //111001101010001
  9.  
  10.  
  11. int map[100][100],map2[100][100];
  12.  
  13. queue <pair<int,int> > q;
  14.  
  15. void wave (int n, int m,int x,int y,int lvl)
  16. {
  17. if (x>=n) return;
  18. if (x<0) return;
  19. if (y>=m) return;
  20. if (y<0) return;
  21. if (map[x][y]==-1) return;
  22.  
  23. map[x][y]=lvl;
  24.  
  25. q.push(pair(x+1,y));
  26. q.push(pair(x,y+1));
  27. q.push(pair(x-1,y));
  28. q.push(pair(x,y-1));
  29.  
  30.  
  31. wave(n,m,q.front().first,q.front().second,lvl+1);
  32.  
  33.  
  34. }
  35.  
  36. int main ()
  37. {
  38. freopen("input.txt","r",stdin);
  39. freopen("output.txt","w",stdout);
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. }
Add Comment
Please, Sign In to add comment