Submission #88280

# Submission time Handle Problem Language Result Execution time Memory
88280 2018-12-05T04:50:32 Z Scayre Bomb (IZhO17_bomb) C++14
24 / 100
95 ms 110380 KB
///////////////////////////
//         INFO          //
//                       //
//    Handle -> Scayre   //
//                       //
//   Template vers. 1.1  //
//                       //
//   It'll be accepted   //
//                       //
///////////////////////////

//████╗████████╗██╗███████╗══███╗═══███╗████████╗════//
//═██╔╝═══██╔══╝╚█║██╔════╝══████╗═████║██╔═════╝═══//
//═██║════██║════╚╝███████╗══██╔████╔██║█████╗══════//
//═██║════██║══════╚════██║══██║╚██╔╝██║██╔══╝══════//
//████╗═══██║══════███████║══██║═╚═╝═██║███████╗═════//


#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>

#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);

#define f first
#define s second

#define inf (int)1e9 + 7

#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define mp(x,y) make_pair(x,y)

#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)

#define pb push_back
#define ppb pop_back

#define bitcoin __builtin_popcount

#define endl "\n"

#define in(x) insert(x)

#define sz(x) (int)x.size()

#define all(x) x.begin(),x.end()

#define pw2(x) (1<<x) //2^x

#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)

#define sqr(x) ((x) * 1ll * (x))

#define UpdateRandom srand (time(NULL));

using namespace std;

const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;

int n,m;

string s[N];

int cntv[N],cntd[N];

int l=inf,r=inf;

int main(){

	#ifdef IOI2019
		freopen ("in.txt", "r", stdin);
	#endif

	NFS

	cin >> n >> m;

	for(int i=1;i<=n;i++){
		cin >> s[i];
	}

	for(int j=0;j<sz(s[1]);j++){
		int cur=0;
		cntv[j]=inf;
		for(int i=1;i<=n;i++){
			if(s[i][j]=='0'){
				continue;
			}
			if(s[i+1][j]=='0'){
				cntv[j]=min(cur+1,cntv[j]);
				cur=0;
				continue;
			}
			cur++;
		}
		if(cur!=0)cntv[j]=min(cur,cntv[j]);
	}

	for(int i=1;i<=n;i++){
		int cur=0;
		cntd[i]=inf;
		for(int j=0;j<sz(s[i]);j++){
			if(s[i][j]=='0'){
				continue;
			}
			if(s[i][j+1]=='0'){
				cntd[i]=min(cur+1,cntd[i]);
				cur=0;
				continue;
			}
			cur++;
		}
		if(cur!=0)cntd[i]=min(cur,cntd[i]);
	}

	for(int i=1;i<=n;i++){
		if(cntd[i]==0){
			continue;
		}
		l=min(cntd[i],l);
	}

	if(l==inf)l=0;

	for(int i=0;i<sz(s[1]);i++){
		if(cntv[i]==0){
			continue;
		}
		r=min(cntv[i],r);
	}

	if(r==inf)r=0;

	cout << l*r << endl;

	#ifdef IOI2019
		cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
	#endif

	ioi
}
# Verdict Execution time Memory Grader output
1 Correct 19 ms 15992 KB Output is correct
2 Correct 19 ms 16132 KB Output is correct
3 Correct 24 ms 16200 KB Output is correct
4 Correct 20 ms 16284 KB Output is correct
5 Correct 19 ms 16324 KB Output is correct
6 Correct 19 ms 16324 KB Output is correct
7 Correct 20 ms 16324 KB Output is correct
8 Incorrect 18 ms 16324 KB Output isn't correct
9 Incorrect 19 ms 16324 KB Output isn't correct
10 Incorrect 20 ms 16324 KB Output isn't correct
11 Incorrect 21 ms 16324 KB Output isn't correct
12 Incorrect 18 ms 16324 KB Output isn't correct
13 Correct 18 ms 16324 KB Output is correct
14 Correct 21 ms 16324 KB Output is correct
15 Incorrect 17 ms 16324 KB Output isn't correct
16 Correct 19 ms 16428 KB Output is correct
17 Correct 20 ms 16428 KB Output is correct
18 Incorrect 19 ms 16428 KB Output isn't correct
19 Incorrect 19 ms 16428 KB Output isn't correct
20 Incorrect 17 ms 16428 KB Output isn't correct
21 Incorrect 18 ms 16428 KB Output isn't correct
22 Incorrect 17 ms 16428 KB Output isn't correct
23 Incorrect 17 ms 16428 KB Output isn't correct
24 Incorrect 20 ms 16428 KB Output isn't correct
25 Incorrect 20 ms 16428 KB Output isn't correct
26 Correct 19 ms 16428 KB Output is correct
27 Correct 21 ms 16600 KB Output is correct
28 Incorrect 21 ms 16648 KB Output isn't correct
29 Incorrect 21 ms 16760 KB Output isn't correct
30 Incorrect 21 ms 17012 KB Output isn't correct
31 Incorrect 21 ms 17136 KB Output isn't correct
32 Incorrect 19 ms 17336 KB Output isn't correct
33 Incorrect 21 ms 17492 KB Output isn't correct
34 Incorrect 18 ms 17492 KB Output isn't correct
35 Incorrect 20 ms 17512 KB Output isn't correct
36 Correct 23 ms 17600 KB Output is correct
37 Incorrect 20 ms 17600 KB Output isn't correct
38 Correct 84 ms 30168 KB Output is correct
39 Incorrect 22 ms 30168 KB Output isn't correct
40 Incorrect 26 ms 30168 KB Output isn't correct
41 Incorrect 21 ms 30168 KB Output isn't correct
42 Incorrect 20 ms 30168 KB Output isn't correct
43 Correct 78 ms 36696 KB Output is correct
44 Incorrect 20 ms 36696 KB Output isn't correct
45 Incorrect 87 ms 42784 KB Output isn't correct
46 Correct 83 ms 42784 KB Output is correct
47 Incorrect 60 ms 42884 KB Output isn't correct
48 Incorrect 81 ms 42884 KB Output isn't correct
49 Correct 84 ms 43132 KB Output is correct
50 Incorrect 80 ms 47768 KB Output isn't correct
51 Incorrect 84 ms 53912 KB Output isn't correct
52 Incorrect 78 ms 53912 KB Output isn't correct
53 Incorrect 70 ms 53940 KB Output isn't correct
54 Incorrect 66 ms 53940 KB Output isn't correct
55 Incorrect 68 ms 54308 KB Output isn't correct
56 Correct 95 ms 54360 KB Output is correct
57 Incorrect 66 ms 56912 KB Output isn't correct
58 Incorrect 72 ms 62984 KB Output isn't correct
59 Incorrect 67 ms 68332 KB Output isn't correct
60 Correct 76 ms 68332 KB Output is correct
61 Correct 70 ms 68332 KB Output is correct
62 Correct 80 ms 68332 KB Output is correct
63 Correct 79 ms 68332 KB Output is correct
64 Correct 70 ms 68332 KB Output is correct
65 Incorrect 78 ms 68332 KB Output isn't correct
66 Incorrect 68 ms 68332 KB Output isn't correct
67 Incorrect 70 ms 68332 KB Output isn't correct
68 Incorrect 68 ms 68548 KB Output isn't correct
69 Incorrect 71 ms 74684 KB Output isn't correct
70 Incorrect 45 ms 76052 KB Output isn't correct
71 Incorrect 64 ms 82396 KB Output isn't correct
72 Incorrect 63 ms 82396 KB Output isn't correct
73 Incorrect 64 ms 82396 KB Output isn't correct
74 Incorrect 66 ms 82396 KB Output isn't correct
75 Incorrect 66 ms 82396 KB Output isn't correct
76 Incorrect 73 ms 82396 KB Output isn't correct
77 Incorrect 63 ms 82396 KB Output isn't correct
78 Incorrect 62 ms 82396 KB Output isn't correct
79 Incorrect 60 ms 82396 KB Output isn't correct
80 Incorrect 59 ms 83716 KB Output isn't correct
81 Incorrect 64 ms 89916 KB Output isn't correct
82 Incorrect 68 ms 95932 KB Output isn't correct
83 Incorrect 64 ms 96508 KB Output isn't correct
84 Incorrect 61 ms 96512 KB Output isn't correct
85 Incorrect 66 ms 96512 KB Output isn't correct
86 Incorrect 68 ms 96512 KB Output isn't correct
87 Incorrect 62 ms 96512 KB Output isn't correct
88 Incorrect 70 ms 96512 KB Output isn't correct
89 Incorrect 69 ms 96640 KB Output isn't correct
90 Incorrect 44 ms 96640 KB Output isn't correct
91 Incorrect 75 ms 96640 KB Output isn't correct
92 Incorrect 67 ms 100032 KB Output isn't correct
93 Incorrect 79 ms 106092 KB Output isn't correct
94 Incorrect 80 ms 110244 KB Output isn't correct
95 Incorrect 69 ms 110252 KB Output isn't correct
96 Incorrect 73 ms 110252 KB Output isn't correct
97 Incorrect 73 ms 110252 KB Output isn't correct
98 Incorrect 71 ms 110300 KB Output isn't correct
99 Incorrect 74 ms 110304 KB Output isn't correct
100 Incorrect 77 ms 110380 KB Output isn't correct