Submission #519056

# Submission time Handle Problem Language Result Execution time Memory
519056 2022-01-25T13:55:31 Z Dasha_Gnedko Bomb (IZhO17_bomb) C++17
18 / 100
185 ms 30788 KB
#include <bits/stdc++.h>

//#include <ext/pb_ds/detail/standard_policies.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx2")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

using namespace std;

//using namespace __gnu_pbds;
//template <typename T> using ordered_set = tree <T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update>;

mt19937 gen(time(0));

#define ll long long
#define ld long double
#define pb push_back
#define F first
#define S second
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define sz(a) int32_t(a.size())
#define endl '\n'
//#define int long long

const int N = 3100;
const int M = 31;
const int mod = 1e9 + 7;
const ll inf = 1e18 + 7;

int a[N][N];

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif // LOCAL

    int n, m;
    cin >> n >> m;
    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
        {
            char c;
            cin >> c;
            a[i][j] = int32_t(c - '0');
        }
    int x = n, y = m, ls = 0;
    for(int i = 0; i < n; i++)
    {
        ls = -1;
        for(int j = 0; j < m; j++)
        {
            if (!a[i][j])
            {
                if (j && a[i][j - 1]) x = min(x, j - ls - 1);
                ls = j;
            }
        }
        if (ls != m - 1) x = min(x, m - ls - 1);
    }
    for(int j = 0; j < m; j++)
    {
        ls = -1;
        for(int i = 0; i < n; i++)
        {
            if (!a[i][j])
            {
                if (i && a[i - 1][j]) y = min(y, i - ls - 1);
                ls = i;
            }
        }
        if (ls != n - 1) y = min(y, n - ls - 1);
    }
    cout << x * y;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Incorrect 1 ms 332 KB Output isn't correct
3 Incorrect 5 ms 10372 KB Output isn't correct
4 Incorrect 4 ms 10316 KB Output isn't correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Incorrect 1 ms 204 KB Output isn't correct
7 Correct 0 ms 332 KB Output is correct
8 Incorrect 1 ms 332 KB Output isn't correct
9 Incorrect 0 ms 332 KB Output isn't correct
10 Incorrect 0 ms 332 KB Output isn't correct
11 Incorrect 1 ms 332 KB Output isn't correct
12 Incorrect 1 ms 332 KB Output isn't correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Incorrect 1 ms 332 KB Output isn't correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Incorrect 1 ms 588 KB Output isn't correct
19 Incorrect 1 ms 588 KB Output isn't correct
20 Incorrect 1 ms 588 KB Output isn't correct
21 Incorrect 1 ms 460 KB Output isn't correct
22 Incorrect 1 ms 588 KB Output isn't correct
23 Incorrect 1 ms 716 KB Output isn't correct
24 Incorrect 2 ms 588 KB Output isn't correct
25 Incorrect 1 ms 716 KB Output isn't correct
26 Correct 1 ms 716 KB Output is correct
27 Correct 2 ms 1740 KB Output is correct
28 Incorrect 3 ms 1868 KB Output isn't correct
29 Incorrect 3 ms 2380 KB Output isn't correct
30 Incorrect 4 ms 2764 KB Output isn't correct
31 Incorrect 3 ms 2124 KB Output isn't correct
32 Incorrect 4 ms 2508 KB Output isn't correct
33 Incorrect 4 ms 2892 KB Output isn't correct
34 Incorrect 2 ms 1996 KB Output isn't correct
35 Incorrect 4 ms 2892 KB Output isn't correct
36 Correct 6 ms 3020 KB Output is correct
37 Incorrect 0 ms 332 KB Output isn't correct
38 Correct 160 ms 30560 KB Output is correct
39 Incorrect 0 ms 332 KB Output isn't correct
40 Incorrect 16 ms 6836 KB Output isn't correct
41 Incorrect 0 ms 332 KB Output isn't correct
42 Incorrect 1 ms 716 KB Output isn't correct
43 Correct 147 ms 30632 KB Output is correct
44 Incorrect 5 ms 2892 KB Output isn't correct
45 Incorrect 149 ms 30612 KB Output isn't correct
46 Correct 146 ms 30624 KB Output is correct
47 Incorrect 144 ms 30632 KB Output isn't correct
48 Incorrect 147 ms 30640 KB Output isn't correct
49 Correct 145 ms 30720 KB Output is correct
50 Incorrect 146 ms 30592 KB Output isn't correct
51 Incorrect 149 ms 30632 KB Output isn't correct
52 Incorrect 156 ms 30632 KB Output isn't correct
53 Incorrect 146 ms 30576 KB Output isn't correct
54 Incorrect 146 ms 30548 KB Output isn't correct
55 Incorrect 148 ms 30640 KB Output isn't correct
56 Correct 144 ms 30588 KB Output is correct
57 Incorrect 152 ms 30636 KB Output isn't correct
58 Incorrect 148 ms 30532 KB Output isn't correct
59 Incorrect 155 ms 30636 KB Output isn't correct
60 Correct 167 ms 30676 KB Output is correct
61 Correct 140 ms 30532 KB Output is correct
62 Correct 142 ms 30580 KB Output is correct
63 Correct 140 ms 30564 KB Output is correct
64 Correct 151 ms 30584 KB Output is correct
65 Incorrect 148 ms 30576 KB Output isn't correct
66 Incorrect 147 ms 30640 KB Output isn't correct
67 Incorrect 150 ms 30532 KB Output isn't correct
68 Incorrect 159 ms 30788 KB Output isn't correct
69 Incorrect 144 ms 30592 KB Output isn't correct
70 Incorrect 93 ms 23944 KB Output isn't correct
71 Incorrect 154 ms 30640 KB Output isn't correct
72 Incorrect 156 ms 30572 KB Output isn't correct
73 Incorrect 148 ms 30632 KB Output isn't correct
74 Incorrect 150 ms 30636 KB Output isn't correct
75 Incorrect 152 ms 30660 KB Output isn't correct
76 Incorrect 164 ms 30600 KB Output isn't correct
77 Incorrect 146 ms 30532 KB Output isn't correct
78 Incorrect 145 ms 30532 KB Output isn't correct
79 Incorrect 185 ms 30612 KB Output isn't correct
80 Incorrect 154 ms 30552 KB Output isn't correct
81 Incorrect 147 ms 30568 KB Output isn't correct
82 Incorrect 145 ms 30628 KB Output isn't correct
83 Incorrect 149 ms 30600 KB Output isn't correct
84 Incorrect 151 ms 30596 KB Output isn't correct
85 Incorrect 149 ms 30636 KB Output isn't correct
86 Incorrect 150 ms 30636 KB Output isn't correct
87 Incorrect 162 ms 30608 KB Output isn't correct
88 Incorrect 150 ms 30536 KB Output isn't correct
89 Incorrect 148 ms 30636 KB Output isn't correct
90 Incorrect 107 ms 23876 KB Output isn't correct
91 Incorrect 152 ms 30636 KB Output isn't correct
92 Incorrect 145 ms 30668 KB Output isn't correct
93 Incorrect 143 ms 30588 KB Output isn't correct
94 Incorrect 162 ms 30620 KB Output isn't correct
95 Incorrect 145 ms 30576 KB Output isn't correct
96 Incorrect 144 ms 30532 KB Output isn't correct
97 Incorrect 148 ms 30532 KB Output isn't correct
98 Incorrect 162 ms 30612 KB Output isn't correct
99 Incorrect 148 ms 30628 KB Output isn't correct
100 Incorrect 143 ms 30508 KB Output isn't correct