제출 #171920

#제출 시각아이디문제언어결과실행 시간메모리
171920mosiashvililukaBomb (IZhO17_bomb)C++14
20 / 100
561 ms61840 KiB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,lf,rg,pas1,pas2,zx,xc,zm[2509][2509],qv[2509][2509];
char ch;
bool f[2509][2509];
int main(){
    scanf("%d %d\n",&a,&b);
    pas1=a+b+2;pas2=a+b+2;
    for(c=1; c<=a; c++){
        for(d=1; d<=b; d++){
            scanf("%c",&ch);
            if(ch=='1') f[c][d]=1;
        }
        scanf("\n");
    }
    for(d=1; d<=b; d++){
        for(c=1; c<=a; c++){
            if(f[c][d]==1){
                zm[c][d]=zm[c-1][d]+1;
            }
        }
        for(c=a; c>=1; c--){
            if(f[c][d]==1){
                qv[c][d]=qv[c+1][d]+1;
            }
        }
    }
    for(c=1; c<=a; c++){
        lf=a+b+2;rg=a+b+2;
        zx=0;
        for(d=1; d<=b; d++){
            if(f[c][d]==1){
                zx++;
                if(lf>zm[c][d]) lf=zm[c][d];
                if(rg>qv[c][d]) rg=qv[c][d];
            }else{
                if(zx!=0){
                    if(pas1>zx) pas1=zx;
                    if(pas2>lf+rg-1) pas2=lf+rg-1;
                }
                zx=0;lf=a+b+2;rg=a+b+2;
            }
        }
        if(zx!=0){
                    if(pas1>zx) pas1=zx;
                    if(pas2>lf+rg+1) pas2=lf+rg-1;
                }
    }
    cout<<pas1*pas2;
    return 0;
}

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

bomb.cpp: In function 'int main()':
bomb.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d\n",&a,&b);
     ~~~~~^~~~~~~~~~~~~~~~~
bomb.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%c",&ch);
             ~~~~~^~~~~~~~~~
bomb.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
         ~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...