답안 #171774

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171774 2019-12-30T11:05:55 Z mosiashvililuka Bomb (IZhO17_bomb) C++14
24 / 100
53 ms 12824 KB
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,i,j,dp[2509][2509],zx,xc,qw,we,k[2509][2509],pas,dd,mxa,mxb;
string s;
bool f[2509][2509];
int main(){
    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>a>>b;
    for(c=1; c<=a; c++){
        cin>>s;
        for(d=1; d<=b; d++){
            f[c][d]=s[d-1]-'0';
        }
    }
    mxb=mxa=a+b+2;
        for(c=1; c<=a; c++){
        	zx=0;
        	for(d=1; d<=b; d++){
        		if(f[c][d]==1){
        			zx++;
				}else{
				    if(zx!=0) mxa=min(zx,mxa);
					zx=0;
				}
			}
			if(zx!=0) mxa=min(zx,mxa);
		}
		for(d=1; d<=b; d++){
			xc=0;
			for(c=1; c<=a; c++){
				if(f[c][d]==1){
					xc++;
				}else{
				    if(xc!=0) mxb=min(mxb,xc);
					xc=0;
				}
			}
			if(xc!=0) mxb=min(mxb,xc);
		}
		cout<<mxa*mxb;
        return 0;
    for(c=1; c<=a; c++){
        for(d=1; d<=b; d++) dp[c][d]=dp[c-1][d]+dp[c][d-1]-dp[c-1][d-1]+f[c][d];
    }
    d=b;
    for(c=1; c<=a; c++){
        while(d>=1){
            bool bo=0;
            for(i=1; i<=a; i++) for(j=1; j<=b; j++) k[i][j]=0;
            for(i=c; i<=a; i++){
                for(j=d; j<=b; j++){
                    qw=i-c+1;we=j-d+1;
                    if(dp[i][j]-dp[i][we-1]-dp[qw-1][j]+dp[qw-1][we-1]==c*d){
                        k[qw][we]=1;
                    }
                }
            }
/*            if(c==2&&d==2){
                for(i=1; i<=a; i++){
                    for(j=1; j<=b; j++) cout<<k[i][j]<<" ";
                    cout<<endl;
                }
            }
            if(c==2&&d==2) cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl;*/
            for(i=1; i<=a; i++){
                for(j=1; j<=b; j++) k[i][j]=k[i-1][j]+k[i][j-1]-k[i-1][j-1]+k[i][j];
            }
/*            if(c==2&&d==2){
                for(i=1; i<=a; i++){
                    for(j=1; j<=b; j++) cout<<k[i][j]<<" ";
                    cout<<endl;
                }
            }*/
            for(i=1; i<=a; i++){
                if(bo==1) break;
                for(j=1; j<=b; j++){
                    if(f[i][j]==0) continue;
                    qw=i-c+1;we=j-d+1;
                    if(qw<=0) qw=1;
                    if(we<=0) we=1;
                    long long hj=0;
                    hj=k[i][j]-k[qw-1][j]-k[i][we-1]+k[qw-1][we-1];
                    if(hj==0){
                        bo=1;
                        break;
                    }
                }
            }
            if(bo==0){
//                cout<<c<<" "<<d<<" vict"<<endl;
                if(pas<c*d) pas=c*d;
                break;
            }
  //          cout<<c<<" "<<d<<" lose"<<endl;
            d--;
        }
    }
    cout<<pas;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 6520 KB Output is correct
4 Correct 7 ms 6520 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 432 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Incorrect 2 ms 504 KB Output isn't correct
19 Incorrect 2 ms 632 KB Output isn't correct
20 Incorrect 2 ms 632 KB Output isn't correct
21 Incorrect 2 ms 504 KB Output isn't correct
22 Incorrect 2 ms 632 KB Output isn't correct
23 Incorrect 2 ms 632 KB Output isn't correct
24 Incorrect 2 ms 632 KB Output isn't correct
25 Incorrect 2 ms 632 KB Output isn't correct
26 Correct 2 ms 636 KB Output is correct
27 Correct 10 ms 1144 KB Output is correct
28 Incorrect 3 ms 1144 KB Output isn't correct
29 Incorrect 3 ms 1400 KB Output isn't correct
30 Incorrect 4 ms 1528 KB Output isn't correct
31 Incorrect 4 ms 1272 KB Output isn't correct
32 Incorrect 4 ms 1528 KB Output isn't correct
33 Incorrect 4 ms 1516 KB Output isn't correct
34 Incorrect 3 ms 1400 KB Output isn't correct
35 Incorrect 4 ms 1656 KB Output isn't correct
36 Correct 4 ms 1656 KB Output is correct
37 Incorrect 2 ms 376 KB Output isn't correct
38 Correct 36 ms 12408 KB Output is correct
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 9 ms 3192 KB Output isn't correct
41 Incorrect 2 ms 376 KB Output isn't correct
42 Incorrect 2 ms 632 KB Output isn't correct
43 Correct 52 ms 12536 KB Output is correct
44 Incorrect 4 ms 1656 KB Output isn't correct
45 Incorrect 43 ms 11356 KB Output isn't correct
46 Correct 45 ms 12652 KB Output is correct
47 Incorrect 43 ms 12536 KB Output isn't correct
48 Incorrect 38 ms 10488 KB Output isn't correct
49 Correct 41 ms 12280 KB Output is correct
50 Incorrect 45 ms 12664 KB Output isn't correct
51 Incorrect 45 ms 12536 KB Output isn't correct
52 Incorrect 43 ms 11640 KB Output isn't correct
53 Incorrect 44 ms 12648 KB Output isn't correct
54 Incorrect 45 ms 12408 KB Output isn't correct
55 Incorrect 52 ms 12536 KB Output isn't correct
56 Correct 42 ms 12068 KB Output is correct
57 Incorrect 53 ms 12536 KB Output isn't correct
58 Incorrect 44 ms 12664 KB Output isn't correct
59 Incorrect 39 ms 12536 KB Output isn't correct
60 Correct 41 ms 12536 KB Output is correct
61 Correct 39 ms 12664 KB Output is correct
62 Correct 41 ms 12664 KB Output is correct
63 Correct 39 ms 12664 KB Output is correct
64 Correct 50 ms 12688 KB Output is correct
65 Incorrect 49 ms 12664 KB Output isn't correct
66 Incorrect 41 ms 12152 KB Output isn't correct
67 Incorrect 39 ms 12664 KB Output isn't correct
68 Incorrect 40 ms 12680 KB Output isn't correct
69 Incorrect 41 ms 12664 KB Output isn't correct
70 Incorrect 29 ms 9208 KB Output isn't correct
71 Incorrect 42 ms 12664 KB Output isn't correct
72 Incorrect 41 ms 11896 KB Output isn't correct
73 Incorrect 42 ms 12664 KB Output isn't correct
74 Incorrect 41 ms 12536 KB Output isn't correct
75 Incorrect 41 ms 12576 KB Output isn't correct
76 Incorrect 43 ms 11128 KB Output isn't correct
77 Incorrect 43 ms 12536 KB Output isn't correct
78 Incorrect 42 ms 11256 KB Output isn't correct
79 Incorrect 43 ms 12600 KB Output isn't correct
80 Incorrect 46 ms 12692 KB Output isn't correct
81 Incorrect 44 ms 12536 KB Output isn't correct
82 Incorrect 42 ms 12536 KB Output isn't correct
83 Incorrect 49 ms 12636 KB Output isn't correct
84 Incorrect 44 ms 12664 KB Output isn't correct
85 Incorrect 43 ms 12824 KB Output isn't correct
86 Incorrect 50 ms 12664 KB Output isn't correct
87 Incorrect 40 ms 12664 KB Output isn't correct
88 Incorrect 41 ms 12536 KB Output isn't correct
89 Incorrect 43 ms 12692 KB Output isn't correct
90 Incorrect 25 ms 9208 KB Output isn't correct
91 Incorrect 40 ms 12664 KB Output isn't correct
92 Incorrect 41 ms 12664 KB Output isn't correct
93 Incorrect 40 ms 12664 KB Output isn't correct
94 Incorrect 38 ms 12792 KB Output isn't correct
95 Incorrect 40 ms 12536 KB Output isn't correct
96 Incorrect 43 ms 12664 KB Output isn't correct
97 Incorrect 39 ms 12664 KB Output isn't correct
98 Incorrect 41 ms 12564 KB Output isn't correct
99 Incorrect 41 ms 12536 KB Output isn't correct
100 Incorrect 41 ms 12696 KB Output isn't correct