제출 #85389

#제출 시각아이디문제언어결과실행 시간메모리
85389DiegoGarciaStrah (COCI18_strah)C++11
22 / 110
1098 ms38044 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

strah.cpp: In function 'int main()':
strah.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld",&n,&m);
     ~~~~~^~~~~~~~~~~~~~~~~~~
strah.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf(" %c",&mat[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...