This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long n,m,c=0;
char a[11][11]={0,0};
long long vis[11][11]={0,0};
/* void dfs(long long i,long long j)
{
c++;
vis[i][j]=1;
if(i>0 && a[i-1][j]=='.' && vis[i-1][j]==0)
{
dfs(i-1,j);
}
if(i<n-1&&a[i+1][j]=='.' && vis[i+1][j]==0)
{
dfs(i+1,j);
}
if(j>0 && a[i][j-1]=='.' && vis[i][j-1]==0)
{
dfs(i,j-1);
}
if(j<m-1&&a[i][j+1]=='.'&&vis[i][j+1]==0)
{
dfs(i,j+1);
}
}*/
int main()
{
//BRUTE
// cout << "Hello world!" << endl;
ios_base::sync_with_stdio(0);
cin.tie(0);
long long s=0;
cin>>n>>m;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
for(int b=i;b<n;b++)//firsting rectas
{
for(int l=j;l<m;l+=1)
{
long long c=0,r=0;
for(int y=i;y<=b;y+=1)
{
//Make rectangels of recatngles
//inin rectas
for(int u=j;u<=l;u++)
{
if(a[y][u]=='.')
{
c++;
}
else r=1;
}
}
if(r<1)
{if(c>0)
s+=c;
}
}
}
}
}
cout<<s<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |