# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
51934 |
2018-06-22T16:54:52 Z |
Nicksechko |
Bomb (IZhO17_bomb) |
C++14 |
|
122 ms |
262144 KB |
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <random>
#include <chrono>
#include <queue>
#include <unordered_map>
//#include <unordered_set>
#include <iomanip>
#include <stack>
#include <ctime>
#include <cassert>
#include <cmath>
#define y1 ups
#define left lll
#define right rrr
#define next nnn
//#define find fff
typedef unsigned long long ull;
using namespace std;
//mt19937_64 twister(chrono::steady_clock().now().time_since_epoch().count());
//mt19937_64 twister(8888);
//
//long long rnd(long long l, long long r)
//{
// uniform_int_distribution<long long> dis(l, r);
// return dis(twister);
//}
const int mod = (int)1e9 + 9;
//const int mod[2] = {(int)1e9 + 7, (int)1e9 + 9};
//const int st[2] = {887, 8887};'
const int maxn = 1e6 + 88;
const int inf = 1e9 + 88;
const int logn = 22;
const int maxa = 500*500 + 88;
const int block = 775;
const long long infll = 1e18 + 88;
const char sgl[5] = {'a', 'e', 'i', 'o', 'u'};
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const int knightx[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int knighty[] = {-1, 1, -2, 2, -2, 2, -1, 1};
const int kingx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int kingy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const char sep = 'a' - 1;
const double eps = 1e-9;
const int maxn1 = 1e3 + 88;
//#define int long long
//
//inline int readint()
//{
// int x = 0;
// char ch = getchar_unlocked();
// while (ch < '0' || ch > '9')
// ch = getchar_unlocked();
// while (ch >= '0' && ch <= '9')
// {
// x = (x << 3) + (x << 1) + ch - '0';
// ch = getchar_unlocked();
// }
// return x;
//}
int a[2588][2588];
string s;
void solve()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// ifstream cin("input.txt");
// ofstream cout("output.txt");
// ifstream cin("bootfall.in");
// ofstream cout("bootfall.out");
int n, m, i, j, ansv = inf, ansg = inf;
cin >> n >> m;
for (i = 0; i < n; i++)
{
cin >> s;
for (j = 0; j < m; j++)
a[i][j] = s[j] - '0';
}
for (i = 0; i < n; i++)
{
int last = -1;
for (j = 0; j < m; j++)
if (a[i][j] == 0)
{
if (j != last + 1)
ansg = min(ansg, j - last - 1);
last = j;
}
if (last + 1 != m)
ansg = min(ansg, m - last - 1);
}
for (j = 0; j < m; j++)
{
int last = -1;
for (i = 0; i < n; i++)
if (a[i][j] == 0)
{
if (i != last + 1)
ansv = min(ansv, i - last - 1);
last = i;
}
if (last + 1 != n)
ansv = min(ansv, n - last - 1);
}
cout << ansv*ansg;
}
//#undef int
int main()
{
// srand(time(0));
// srand(8);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// ifstream cin("input.txt");
// ofstream cout("output.txt");
// ifstream cin("output.txt");
// ifstream fin("12.out");
// int a, b, i = 0;
// while (cin >> a)
// {
// fin >> b;
// if (a != b)
// {
// cout << i << " " << a << " " << b;
// return 0;
// }
// i++;
// }
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// freopen("f.in", "r", stdin);
// freopen("f.out", "w", stdout);
// int t = 10000;
// while (t--)
// {
// if (t == 9947)
// t = 9947;
// gen();
// cout << t << endl;
// brut();
// if (!solve())
// {
// cout << "kek";
// return 0;
// }
// }
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
392 KB |
Output is correct |
2 |
Correct |
2 ms |
496 KB |
Output is correct |
3 |
Correct |
9 ms |
10552 KB |
Output is correct |
4 |
Correct |
8 ms |
10552 KB |
Output is correct |
5 |
Correct |
3 ms |
10552 KB |
Output is correct |
6 |
Correct |
3 ms |
10552 KB |
Output is correct |
7 |
Correct |
2 ms |
10552 KB |
Output is correct |
8 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
11 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
12 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
13 |
Correct |
2 ms |
10552 KB |
Output is correct |
14 |
Correct |
3 ms |
10552 KB |
Output is correct |
15 |
Incorrect |
3 ms |
10552 KB |
Output isn't correct |
16 |
Correct |
3 ms |
10552 KB |
Output is correct |
17 |
Correct |
2 ms |
10552 KB |
Output is correct |
18 |
Incorrect |
3 ms |
10552 KB |
Output isn't correct |
19 |
Incorrect |
3 ms |
10552 KB |
Output isn't correct |
20 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
21 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
22 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
23 |
Incorrect |
3 ms |
10552 KB |
Output isn't correct |
24 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
25 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
26 |
Correct |
2 ms |
10552 KB |
Output is correct |
27 |
Correct |
4 ms |
10552 KB |
Output is correct |
28 |
Incorrect |
5 ms |
10552 KB |
Output isn't correct |
29 |
Incorrect |
5 ms |
10552 KB |
Output isn't correct |
30 |
Incorrect |
5 ms |
10552 KB |
Output isn't correct |
31 |
Incorrect |
4 ms |
10552 KB |
Output isn't correct |
32 |
Incorrect |
6 ms |
10552 KB |
Output isn't correct |
33 |
Incorrect |
8 ms |
10552 KB |
Output isn't correct |
34 |
Incorrect |
5 ms |
10552 KB |
Output isn't correct |
35 |
Incorrect |
5 ms |
10552 KB |
Output isn't correct |
36 |
Correct |
5 ms |
10552 KB |
Output is correct |
37 |
Incorrect |
2 ms |
10552 KB |
Output isn't correct |
38 |
Correct |
75 ms |
33844 KB |
Output is correct |
39 |
Incorrect |
2 ms |
33844 KB |
Output isn't correct |
40 |
Incorrect |
12 ms |
33844 KB |
Output isn't correct |
41 |
Incorrect |
2 ms |
33844 KB |
Output isn't correct |
42 |
Incorrect |
2 ms |
33844 KB |
Output isn't correct |
43 |
Correct |
82 ms |
40704 KB |
Output is correct |
44 |
Incorrect |
5 ms |
40704 KB |
Output isn't correct |
45 |
Incorrect |
104 ms |
47052 KB |
Output isn't correct |
46 |
Correct |
76 ms |
53120 KB |
Output is correct |
47 |
Incorrect |
81 ms |
59248 KB |
Output isn't correct |
48 |
Incorrect |
80 ms |
65376 KB |
Output isn't correct |
49 |
Correct |
77 ms |
71580 KB |
Output is correct |
50 |
Incorrect |
77 ms |
77712 KB |
Output isn't correct |
51 |
Incorrect |
78 ms |
83716 KB |
Output isn't correct |
52 |
Incorrect |
80 ms |
89844 KB |
Output isn't correct |
53 |
Incorrect |
80 ms |
95976 KB |
Output isn't correct |
54 |
Incorrect |
77 ms |
102104 KB |
Output isn't correct |
55 |
Incorrect |
78 ms |
108228 KB |
Output isn't correct |
56 |
Correct |
74 ms |
114356 KB |
Output is correct |
57 |
Incorrect |
80 ms |
120612 KB |
Output isn't correct |
58 |
Incorrect |
83 ms |
126708 KB |
Output isn't correct |
59 |
Incorrect |
87 ms |
132848 KB |
Output isn't correct |
60 |
Correct |
77 ms |
138868 KB |
Output is correct |
61 |
Correct |
77 ms |
144980 KB |
Output is correct |
62 |
Correct |
76 ms |
151220 KB |
Output is correct |
63 |
Correct |
79 ms |
157240 KB |
Output is correct |
64 |
Correct |
103 ms |
163372 KB |
Output is correct |
65 |
Incorrect |
122 ms |
169496 KB |
Output isn't correct |
66 |
Incorrect |
105 ms |
175640 KB |
Output isn't correct |
67 |
Incorrect |
84 ms |
181880 KB |
Output isn't correct |
68 |
Incorrect |
87 ms |
188032 KB |
Output isn't correct |
69 |
Incorrect |
98 ms |
194076 KB |
Output isn't correct |
70 |
Incorrect |
51 ms |
194076 KB |
Output isn't correct |
71 |
Incorrect |
101 ms |
204048 KB |
Output isn't correct |
72 |
Incorrect |
82 ms |
210324 KB |
Output isn't correct |
73 |
Incorrect |
110 ms |
216392 KB |
Output isn't correct |
74 |
Incorrect |
96 ms |
222536 KB |
Output isn't correct |
75 |
Incorrect |
96 ms |
228880 KB |
Output isn't correct |
76 |
Incorrect |
93 ms |
234892 KB |
Output isn't correct |
77 |
Incorrect |
81 ms |
240928 KB |
Output isn't correct |
78 |
Incorrect |
121 ms |
246984 KB |
Output isn't correct |
79 |
Incorrect |
85 ms |
253180 KB |
Output isn't correct |
80 |
Incorrect |
103 ms |
259360 KB |
Output isn't correct |
81 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |
82 |
Incorrect |
87 ms |
262144 KB |
Output isn't correct |
83 |
Incorrect |
106 ms |
262144 KB |
Output isn't correct |
84 |
Incorrect |
89 ms |
262144 KB |
Output isn't correct |
85 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |
86 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |
87 |
Incorrect |
84 ms |
262144 KB |
Output isn't correct |
88 |
Incorrect |
115 ms |
262144 KB |
Output isn't correct |
89 |
Incorrect |
93 ms |
262144 KB |
Output isn't correct |
90 |
Incorrect |
48 ms |
262144 KB |
Output isn't correct |
91 |
Incorrect |
85 ms |
262144 KB |
Output isn't correct |
92 |
Incorrect |
84 ms |
262144 KB |
Output isn't correct |
93 |
Incorrect |
81 ms |
262144 KB |
Output isn't correct |
94 |
Incorrect |
85 ms |
262144 KB |
Output isn't correct |
95 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |
96 |
Incorrect |
102 ms |
262144 KB |
Output isn't correct |
97 |
Incorrect |
99 ms |
262144 KB |
Output isn't correct |
98 |
Incorrect |
83 ms |
262144 KB |
Output isn't correct |
99 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |
100 |
Incorrect |
86 ms |
262144 KB |
Output isn't correct |