Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int n,m,x,y;
- int map[1005][1005];
- int kq=0;
- void ihihi(int x,int y){
- if(x<=n&&y<=m&&x>0&&y>0&&map[x][y]==0){
- map[x][y]=1;
- kq++;
- ihihi(x+1,y);
- ihihi(x-1,y);
- ihihi(x,y-1);
- ihihi(x,y+1);
- }
- else return;
- }
- int main()
- {
- std::cin >> n >> m >> x >> y;
- for(int i=1 ; i<=n ; i++){
- for(int j=1 ; j<=m ; j++){
- std::cin >> map[i][j];
- }
- }
- ihihi(x,y);
- std::cout << kq;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement