Submission #172148

# Submission time Handle Problem Language Result Execution time Memory
172148 2019-12-31T11:30:55 Z MvC Bomb (IZhO17_bomb) C++11
24 / 100
389 ms 96248 KB
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const int nmax=3e3+50;
const int mod=1e9+7;
using namespace std;
int n,m,i,j,cur,h[nmax][nmax],v[nmax][nmax],x,y,a[nmax][nmax];
char c;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=m;j++)
		{
			cin>>c;
			a[i][j]=(c=='1');
		}
	}
	x=y=inf;
	for(i=1;i<=n;i++)
	{
		for(j=m;j>=1;j--)
		{
			if(a[i][j])
			{
				h[i][j]=h[i][j+1]+1;
				if(!a[i][j-1])y=min(y,h[i][j]);
			}
		}
	}
	for(i=1;i<=m;i++)
	{
		for(j=n;j>=1;j--)
		{
			if(a[j][i])
			{
				v[j][i]=v[j+1][i]+1;
				if(!a[j-1][i])x=min(x,v[j][i]);
			}
		}
	}
	if(x==inf)rc(0);
	cout<<x*y<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 29 ms 30428 KB Output is correct
4 Correct 29 ms 30456 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 504 KB Output isn't correct
9 Incorrect 2 ms 504 KB Output isn't correct
10 Incorrect 2 ms 504 KB Output isn't correct
11 Incorrect 2 ms 504 KB Output isn't correct
12 Incorrect 2 ms 476 KB Output isn't correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Incorrect 4 ms 504 KB Output isn't correct
16 Correct 3 ms 632 KB Output is correct
17 Correct 3 ms 1144 KB Output is correct
18 Incorrect 2 ms 888 KB Output isn't correct
19 Incorrect 3 ms 1272 KB Output isn't correct
20 Incorrect 3 ms 1144 KB Output isn't correct
21 Incorrect 2 ms 632 KB Output isn't correct
22 Incorrect 2 ms 1016 KB Output isn't correct
23 Incorrect 3 ms 1272 KB Output isn't correct
24 Incorrect 3 ms 1144 KB Output isn't correct
25 Incorrect 3 ms 1528 KB Output isn't correct
26 Correct 3 ms 1656 KB Output is correct
27 Correct 8 ms 4856 KB Output is correct
28 Incorrect 6 ms 2424 KB Output isn't correct
29 Incorrect 10 ms 6232 KB Output isn't correct
30 Incorrect 10 ms 5752 KB Output isn't correct
31 Incorrect 8 ms 4344 KB Output isn't correct
32 Incorrect 9 ms 5496 KB Output isn't correct
33 Incorrect 12 ms 7032 KB Output isn't correct
34 Incorrect 5 ms 2680 KB Output isn't correct
35 Incorrect 8 ms 3704 KB Output isn't correct
36 Correct 13 ms 8312 KB Output is correct
37 Incorrect 2 ms 632 KB Output isn't correct
38 Correct 378 ms 95992 KB Output is correct
39 Incorrect 2 ms 632 KB Output isn't correct
40 Incorrect 43 ms 20696 KB Output isn't correct
41 Incorrect 2 ms 636 KB Output isn't correct
42 Incorrect 3 ms 1656 KB Output isn't correct
43 Correct 328 ms 86648 KB Output is correct
44 Incorrect 11 ms 7672 KB Output isn't correct
45 Incorrect 314 ms 85880 KB Output isn't correct
46 Correct 321 ms 96248 KB Output is correct
47 Incorrect 314 ms 86064 KB Output isn't correct
48 Incorrect 312 ms 96124 KB Output isn't correct
49 Correct 371 ms 95940 KB Output is correct
50 Incorrect 318 ms 96152 KB Output isn't correct
51 Incorrect 318 ms 95992 KB Output isn't correct
52 Incorrect 316 ms 95988 KB Output isn't correct
53 Incorrect 318 ms 95308 KB Output isn't correct
54 Incorrect 257 ms 77048 KB Output isn't correct
55 Incorrect 253 ms 72444 KB Output isn't correct
56 Correct 381 ms 96040 KB Output is correct
57 Incorrect 255 ms 65368 KB Output isn't correct
58 Incorrect 252 ms 70392 KB Output isn't correct
59 Incorrect 242 ms 67356 KB Output isn't correct
60 Correct 305 ms 87800 KB Output is correct
61 Correct 374 ms 95996 KB Output is correct
62 Correct 372 ms 95992 KB Output is correct
63 Correct 389 ms 95992 KB Output is correct
64 Correct 254 ms 78840 KB Output is correct
65 Incorrect 312 ms 94856 KB Output isn't correct
66 Incorrect 298 ms 82168 KB Output isn't correct
67 Incorrect 321 ms 96060 KB Output isn't correct
68 Incorrect 332 ms 95992 KB Output isn't correct
69 Incorrect 247 ms 64992 KB Output isn't correct
70 Incorrect 127 ms 38008 KB Output isn't correct
71 Incorrect 223 ms 57928 KB Output isn't correct
72 Incorrect 238 ms 63608 KB Output isn't correct
73 Incorrect 241 ms 64376 KB Output isn't correct
74 Incorrect 241 ms 65600 KB Output isn't correct
75 Incorrect 243 ms 67192 KB Output isn't correct
76 Incorrect 249 ms 68600 KB Output isn't correct
77 Incorrect 251 ms 69112 KB Output isn't correct
78 Incorrect 253 ms 69240 KB Output isn't correct
79 Incorrect 177 ms 41720 KB Output isn't correct
80 Incorrect 175 ms 42620 KB Output isn't correct
81 Incorrect 181 ms 43152 KB Output isn't correct
82 Incorrect 257 ms 70648 KB Output isn't correct
83 Incorrect 256 ms 71672 KB Output isn't correct
84 Incorrect 172 ms 36600 KB Output isn't correct
85 Incorrect 257 ms 70648 KB Output isn't correct
86 Incorrect 357 ms 93856 KB Output isn't correct
87 Incorrect 249 ms 69460 KB Output isn't correct
88 Incorrect 288 ms 70636 KB Output isn't correct
89 Incorrect 289 ms 79464 KB Output isn't correct
90 Incorrect 152 ms 52176 KB Output isn't correct
91 Incorrect 265 ms 74076 KB Output isn't correct
92 Incorrect 286 ms 79992 KB Output isn't correct
93 Incorrect 349 ms 93148 KB Output isn't correct
94 Incorrect 291 ms 80052 KB Output isn't correct
95 Incorrect 255 ms 72056 KB Output isn't correct
96 Incorrect 257 ms 71408 KB Output isn't correct
97 Incorrect 358 ms 93500 KB Output isn't correct
98 Incorrect 258 ms 71544 KB Output isn't correct
99 Incorrect 284 ms 79352 KB Output isn't correct
100 Incorrect 348 ms 92644 KB Output isn't correct