Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(i=1;i<=n;i++)
- for(j=1;j<=m;j++)
- if(a[i][j]==0) cnt++;
- fout<<cnt<<"\n";
- fout.close();
- }
- void Cerinta2()
- {
- int l,c,x,y,i,j,k,r;
- for(l=1;l<=n;l++)
- for(c=1;c<=m;c++)
- if(a[l][c]!=0)
- {
- r=a[l][c];
- v[r]++;
- a[l][c]=0;
- q.push(make_pair(l,c));
- while(!q.empty())
- {
- x=q.front().first;
- y=q.front().second;
- q.pop();
- for(k=0;k<=3;k++)
- {
- i=x+dx[k];
- j=y+dy[k];
- if(a[i][j]==r)
- {
- q.push(make_pair(i,j));
- a[i][j]=0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement