# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
85389 | DiegoGarcia | Strah (COCI18_strah) | C++11 | 1098 ms | 38044 KiB |
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 <stdio.h>
#define ll long long
ll n,m,DP[2003][2003],sum,ans;
char mat[2003][2003];
int main()
{
//(NM)^2 sirve para los primeros 55 pts
scanf("%lld %lld",&n,&m);
for( ll i=1; i<=n; i++ )
{
for( ll j=1; j<=m; j++ )
{
scanf(" %c",&mat[i][j]);
DP[i][j] = DP[i-1][j] + DP[i][j-1] - DP[i-1][j-1] + ( mat[i][j] == '#' ? 0 : 1 );
}
}
for( ll x1=1; x1<=n; x1++ ){
for( ll y1=1; y1<=m; y1++ ){
for( ll x2=x1; x2<=n; x2++ ){
for( ll y2=y1; y2<=m; y2++ ){
sum = DP[x2][y2] - DP[x2][y1-1] - DP[x1-1][y2] + DP[x1-1][y1-1];
if( sum == (y2-y1+1)*(x2-x1+1) ) ans += (x2-x1+1)*(y2-y1+1);
}
}
}
}
printf("%lld",ans);
return 0;
}
Compilation message (stderr)
# | 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... |