Submission #170254

# Submission time Handle Problem Language Result Execution time Memory
170254 2019-12-24T11:38:22 Z nvmdava Bomb (IZhO17_bomb) C++17
20 / 100
351 ms 55628 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define N 2505

int a[N][N];
int up[N][N], le[N][N];

int h[2505], w[2505];

vector<pair<int, int> > v;


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    memset(h, 0x3f, sizeof h);
    memset(w, 0x3f, sizeof w);
    int n, m;
    cin>>n>>m;
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= m; ++j){
            char c;
            cin>>c;
            a[i][j] = c - '0';
        }
    }
    int mx=  2500;
    for(int i = 1; i <= m; ++i){
        for(int j = 1; j <= n; ++j){
            if(a[j][i] == 0) up[j][i] = 0;
            else up[j][i] = up[j - 1][i] + 1;
            if(a[j + 1][i] == 0 && a[j][i] == 1)mx = min(mx, up[j][i]);
        }
    }
    v.push_back({0, 0});
    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= m + 1; ++j){
            int t = 0;
            while(v.back().ff > up[i][j]){
                v.back().ss += t;
                h[v.back().ff] = min(h[v.back().ff], v.back().ss);
                t = v.back().ss;
                v.pop_back();
                h[v.back().ff + 1] = min(h[v.back().ff + 1], t);
            }
            if(v.back().ff == up[i][j]){
                v.back().ss += 1 + t;
            } else {
                v.push_back({up[i][j], 1 + t});
            }
        }
    }

    int ans = 0;

    for(int i = 1; i <= mx; ++i){
        h[i] = min(h[i - 1], h[i]);
        ans = max(ans, h[i] * i);
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 17 ms 20472 KB Output is correct
4 Correct 17 ms 20472 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 504 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 508 KB Output isn't correct
12 Correct 3 ms 504 KB Output is correct
13 Incorrect 2 ms 504 KB Output isn't correct
14 Correct 2 ms 504 KB Output is correct
15 Incorrect 2 ms 504 KB Output isn't correct
16 Correct 2 ms 504 KB Output is correct
17 Incorrect 3 ms 960 KB Output isn't correct
18 Incorrect 3 ms 1016 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 Correct 2 ms 892 KB Output is correct
22 Incorrect 3 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 1276 KB Output isn't correct
26 Incorrect 3 ms 1316 KB Output isn't correct
27 Incorrect 7 ms 3448 KB Output isn't correct
28 Incorrect 7 ms 3704 KB Output isn't correct
29 Incorrect 9 ms 4604 KB Output isn't correct
30 Incorrect 10 ms 5496 KB Output isn't correct
31 Incorrect 8 ms 4344 KB Output isn't correct
32 Incorrect 9 ms 4984 KB Output isn't correct
33 Incorrect 10 ms 5752 KB Output isn't correct
34 Incorrect 7 ms 3960 KB Output isn't correct
35 Incorrect 11 ms 5752 KB Output isn't correct
36 Incorrect 11 ms 5752 KB Output isn't correct
37 Incorrect 2 ms 576 KB Output isn't correct
38 Correct 332 ms 53728 KB Output is correct
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 34 ms 14200 KB Output isn't correct
41 Incorrect 2 ms 504 KB Output isn't correct
42 Incorrect 3 ms 1272 KB Output isn't correct
43 Correct 347 ms 53752 KB Output is correct
44 Incorrect 11 ms 5752 KB Output isn't correct
45 Incorrect 351 ms 53808 KB Output isn't correct
46 Correct 344 ms 53756 KB Output is correct
47 Incorrect 346 ms 53624 KB Output isn't correct
48 Incorrect 332 ms 53624 KB Output isn't correct
49 Incorrect 334 ms 53616 KB Output isn't correct
50 Incorrect 334 ms 53576 KB Output isn't correct
51 Incorrect 331 ms 53720 KB Output isn't correct
52 Incorrect 337 ms 53624 KB Output isn't correct
53 Incorrect 342 ms 53648 KB Output isn't correct
54 Incorrect 332 ms 53752 KB Output isn't correct
55 Incorrect 335 ms 53624 KB Output isn't correct
56 Correct 332 ms 53812 KB Output is correct
57 Incorrect 330 ms 53624 KB Output isn't correct
58 Incorrect 334 ms 53684 KB Output isn't correct
59 Incorrect 332 ms 53624 KB Output isn't correct
60 Correct 325 ms 53744 KB Output is correct
61 Correct 337 ms 53636 KB Output is correct
62 Correct 330 ms 53752 KB Output is correct
63 Correct 333 ms 53900 KB Output is correct
64 Correct 330 ms 53612 KB Output is correct
65 Incorrect 339 ms 53624 KB Output isn't correct
66 Incorrect 324 ms 53628 KB Output isn't correct
67 Incorrect 331 ms 53608 KB Output isn't correct
68 Incorrect 339 ms 53752 KB Output isn't correct
69 Incorrect 330 ms 53700 KB Output isn't correct
70 Incorrect 208 ms 43512 KB Output isn't correct
71 Incorrect 324 ms 53632 KB Output isn't correct
72 Incorrect 322 ms 53752 KB Output isn't correct
73 Incorrect 324 ms 53880 KB Output isn't correct
74 Incorrect 335 ms 53772 KB Output isn't correct
75 Incorrect 330 ms 53880 KB Output isn't correct
76 Incorrect 337 ms 53812 KB Output isn't correct
77 Incorrect 339 ms 54776 KB Output isn't correct
78 Incorrect 327 ms 55624 KB Output isn't correct
79 Incorrect 329 ms 55544 KB Output isn't correct
80 Incorrect 327 ms 55544 KB Output isn't correct
81 Incorrect 330 ms 55056 KB Output isn't correct
82 Incorrect 329 ms 55288 KB Output isn't correct
83 Incorrect 332 ms 55036 KB Output isn't correct
84 Incorrect 331 ms 54776 KB Output isn't correct
85 Incorrect 327 ms 55544 KB Output isn't correct
86 Incorrect 343 ms 55112 KB Output isn't correct
87 Incorrect 340 ms 55004 KB Output isn't correct
88 Incorrect 335 ms 55048 KB Output isn't correct
89 Incorrect 327 ms 55416 KB Output isn't correct
90 Incorrect 218 ms 43512 KB Output isn't correct
91 Incorrect 326 ms 55260 KB Output isn't correct
92 Incorrect 325 ms 55032 KB Output isn't correct
93 Incorrect 332 ms 55432 KB Output isn't correct
94 Incorrect 326 ms 55628 KB Output isn't correct
95 Incorrect 330 ms 55544 KB Output isn't correct
96 Incorrect 327 ms 55288 KB Output isn't correct
97 Incorrect 331 ms 55164 KB Output isn't correct
98 Incorrect 333 ms 55188 KB Output isn't correct
99 Incorrect 332 ms 55388 KB Output isn't correct
100 Incorrect 332 ms 55416 KB Output isn't correct