Submission #170244

# Submission time Handle Problem Language Result Execution time Memory
170244 2019-12-24T10:52:25 Z nvmdava Bomb (IZhO17_bomb) C++17
15 / 100
397 ms 49824 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];

int h[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);
    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){
            while(v.back().ff > up[i][j]){
                h[v.back().ff] = min(h[v.back().ff], v.back().ss);
                int t = v.back().ss;
                v.pop_back();
                v.back().ss += t;
            }
            if(v.back().ff == up[i][j]){
                ++v.back().ss;
            } else {
                v.push_back({up[i][j], 1});
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= mx; i++){
        h[i] = min(h[i], h[i - 1]);
        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 Incorrect 2 ms 376 KB Output isn't 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 Correct 2 ms 504 KB Output is correct
13 Incorrect 2 ms 504 KB Output isn't correct
14 Correct 2 ms 508 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 1020 KB Output isn't correct
18 Incorrect 1 ms 888 KB Output isn't correct
19 Incorrect 3 ms 1144 KB Output isn't correct
20 Incorrect 3 ms 1144 KB Output isn't correct
21 Incorrect 2 ms 888 KB Output isn't correct
22 Incorrect 3 ms 1016 KB Output isn't correct
23 Incorrect 3 ms 1276 KB Output isn't correct
24 Incorrect 3 ms 1144 KB Output isn't correct
25 Incorrect 3 ms 1272 KB Output isn't correct
26 Incorrect 3 ms 1272 KB Output isn't correct
27 Incorrect 6 ms 3320 KB Output isn't correct
28 Incorrect 7 ms 3576 KB Output isn't correct
29 Incorrect 8 ms 4472 KB Output isn't correct
30 Incorrect 10 ms 5340 KB Output isn't correct
31 Incorrect 8 ms 4220 KB Output isn't correct
32 Incorrect 9 ms 4856 KB Output isn't correct
33 Incorrect 10 ms 5624 KB Output isn't correct
34 Incorrect 6 ms 3832 KB Output isn't correct
35 Incorrect 11 ms 5752 KB Output isn't correct
36 Incorrect 11 ms 5624 KB Output isn't correct
37 Incorrect 2 ms 504 KB Output isn't correct
38 Correct 328 ms 49584 KB Output is correct
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 34 ms 13432 KB Output isn't correct
41 Correct 2 ms 504 KB Output is correct
42 Correct 3 ms 1272 KB Output is correct
43 Incorrect 349 ms 49628 KB Output isn't correct
44 Correct 11 ms 5624 KB Output is correct
45 Incorrect 347 ms 49528 KB Output isn't correct
46 Correct 334 ms 49656 KB Output is correct
47 Incorrect 344 ms 49504 KB Output isn't correct
48 Incorrect 334 ms 49592 KB Output isn't correct
49 Incorrect 333 ms 49532 KB Output isn't correct
50 Incorrect 338 ms 49656 KB Output isn't correct
51 Incorrect 335 ms 49500 KB Output isn't correct
52 Incorrect 338 ms 49680 KB Output isn't correct
53 Incorrect 338 ms 49592 KB Output isn't correct
54 Incorrect 329 ms 49528 KB Output isn't correct
55 Incorrect 334 ms 49684 KB Output isn't correct
56 Correct 340 ms 49656 KB Output is correct
57 Incorrect 326 ms 49528 KB Output isn't correct
58 Incorrect 330 ms 49528 KB Output isn't correct
59 Incorrect 331 ms 49656 KB Output isn't correct
60 Incorrect 327 ms 49636 KB Output isn't correct
61 Incorrect 331 ms 49624 KB Output isn't correct
62 Incorrect 328 ms 49672 KB Output isn't correct
63 Incorrect 329 ms 49528 KB Output isn't correct
64 Incorrect 343 ms 49656 KB Output isn't correct
65 Incorrect 333 ms 49496 KB Output isn't correct
66 Incorrect 328 ms 49596 KB Output isn't correct
67 Incorrect 331 ms 49528 KB Output isn't correct
68 Incorrect 332 ms 49500 KB Output isn't correct
69 Incorrect 332 ms 49552 KB Output isn't correct
70 Incorrect 209 ms 39924 KB Output isn't correct
71 Incorrect 334 ms 49688 KB Output isn't correct
72 Incorrect 335 ms 49536 KB Output isn't correct
73 Incorrect 331 ms 49608 KB Output isn't correct
74 Incorrect 397 ms 49528 KB Output isn't correct
75 Incorrect 330 ms 49612 KB Output isn't correct
76 Incorrect 329 ms 49784 KB Output isn't correct
77 Incorrect 326 ms 49528 KB Output isn't correct
78 Incorrect 330 ms 49824 KB Output isn't correct
79 Incorrect 329 ms 49528 KB Output isn't correct
80 Incorrect 334 ms 49572 KB Output isn't correct
81 Incorrect 337 ms 49648 KB Output isn't correct
82 Incorrect 336 ms 49528 KB Output isn't correct
83 Incorrect 394 ms 49492 KB Output isn't correct
84 Incorrect 335 ms 49528 KB Output isn't correct
85 Incorrect 328 ms 49788 KB Output isn't correct
86 Incorrect 338 ms 49724 KB Output isn't correct
87 Incorrect 333 ms 49660 KB Output isn't correct
88 Incorrect 334 ms 49620 KB Output isn't correct
89 Incorrect 355 ms 49784 KB Output isn't correct
90 Incorrect 208 ms 39804 KB Output isn't correct
91 Incorrect 323 ms 49528 KB Output isn't correct
92 Incorrect 325 ms 49736 KB Output isn't correct
93 Incorrect 331 ms 49592 KB Output isn't correct
94 Incorrect 329 ms 49656 KB Output isn't correct
95 Incorrect 327 ms 49548 KB Output isn't correct
96 Incorrect 324 ms 49656 KB Output isn't correct
97 Incorrect 385 ms 49636 KB Output isn't correct
98 Incorrect 328 ms 49660 KB Output isn't correct
99 Incorrect 328 ms 49656 KB Output isn't correct
100 Incorrect 327 ms 49524 KB Output isn't correct