Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <queue>
- using namespace std;
- //111001101010001
- int map[100][100],map2[100][100];
- queue <pair<int,int> > q;
- void wave (int n, int m,int x,int y,int lvl)
- {
- if (x>=n) return;
- if (x<0) return;
- if (y>=m) return;
- if (y<0) return;
- if (map[x][y]==-1) return;
- map[x][y]=lvl;
- q.push(pair(x+1,y));
- q.push(pair(x,y+1));
- q.push(pair(x-1,y));
- q.push(pair(x,y-1));
- wave(n,m,q.front().first,q.front().second,lvl+1);
- }
- int main ()
- {
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- }
Add Comment
Please, Sign In to add comment