SHARE
TWEET

codeforce - Cakeminator

jakaria_hossain Mar 29th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. int main()
  5. {
  6.     int m,n,rc=0,cc=0;
  7.     cin>>m>>n;
  8.     int row[m+1],clm[n+1];
  9.     memset(row,0,sizeof(row));
  10.     memset(clm,0,sizeof(clm));
  11.     for(int i=0;i<m;i++)
  12.     {
  13.         for(int j=0;j<n;j++)
  14.         {
  15.             char s;
  16.             cin>>s;
  17.             if(s!='.')
  18.             {
  19.                 if(row[i]==0)
  20.                 {
  21.                     rc++;
  22.                     row[i]=1;
  23.                 }
  24.                 if(clm[j]==0)
  25.                 {
  26.                     cc++;
  27.                     clm[j]=1;
  28.                 }
  29.             }
  30.         }
  31.     }
  32.    // cout<<rc<<" "<<cc<<endl;
  33.     /*if(rc*cc>m*n)
  34.     {
  35.         printf("0\n");
  36.         return 0;
  37.     }*/
  38.     printf("%d\n",m*n-rc*cc);
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top