답안 #170256

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170256 2019-12-24T11:54:53 Z nvmdava Bomb (IZhO17_bomb) C++17
40 / 100
370 ms 50696 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;
                t = v.back().ss;
                v.pop_back();
                h[max(up[i][j], v.back().ff) + 1] = min(h[max(up[i][j], 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 508 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 Correct 2 ms 504 KB Output is correct
9 Incorrect 2 ms 504 KB Output isn't correct
10 Correct 2 ms 508 KB Output is correct
11 Correct 2 ms 504 KB Output is correct
12 Correct 2 ms 576 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Correct 2 ms 508 KB Output is correct
16 Correct 2 ms 504 KB Output is correct
17 Incorrect 2 ms 888 KB Output isn't correct
18 Correct 3 ms 1016 KB Output is correct
19 Correct 3 ms 1272 KB Output is correct
20 Incorrect 3 ms 1172 KB Output isn't correct
21 Correct 2 ms 888 KB Output is correct
22 Correct 2 ms 1016 KB Output is correct
23 Incorrect 3 ms 1272 KB Output isn't correct
24 Incorrect 3 ms 1016 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 Correct 7 ms 3448 KB Output is correct
28 Correct 7 ms 3704 KB Output is correct
29 Incorrect 9 ms 4600 KB Output isn't correct
30 Incorrect 11 ms 5496 KB Output isn't correct
31 Incorrect 9 ms 4344 KB Output isn't correct
32 Incorrect 9 ms 4984 KB Output isn't correct
33 Incorrect 11 ms 5800 KB Output isn't correct
34 Correct 6 ms 3960 KB Output is correct
35 Incorrect 11 ms 5752 KB Output isn't correct
36 Incorrect 10 ms 5752 KB Output isn't correct
37 Incorrect 4 ms 504 KB Output isn't correct
38 Correct 333 ms 50552 KB Output is correct
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 36 ms 13944 KB Output isn't correct
41 Incorrect 2 ms 508 KB Output isn't correct
42 Incorrect 3 ms 1272 KB Output isn't correct
43 Correct 344 ms 50552 KB Output is correct
44 Incorrect 11 ms 5752 KB Output isn't correct
45 Incorrect 350 ms 50664 KB Output isn't correct
46 Correct 334 ms 50556 KB Output is correct
47 Incorrect 349 ms 50680 KB Output isn't correct
48 Incorrect 334 ms 50544 KB Output isn't correct
49 Correct 335 ms 50572 KB Output is correct
50 Incorrect 330 ms 50552 KB Output isn't correct
51 Incorrect 335 ms 50520 KB Output isn't correct
52 Incorrect 336 ms 50692 KB Output isn't correct
53 Incorrect 330 ms 50680 KB Output isn't correct
54 Correct 327 ms 50596 KB Output is correct
55 Correct 324 ms 50552 KB Output is correct
56 Correct 331 ms 50680 KB Output is correct
57 Correct 330 ms 50612 KB Output is correct
58 Correct 327 ms 50584 KB Output is correct
59 Correct 326 ms 50580 KB Output is correct
60 Correct 330 ms 50500 KB Output is correct
61 Correct 338 ms 50624 KB Output is correct
62 Correct 329 ms 50572 KB Output is correct
63 Correct 330 ms 50628 KB Output is correct
64 Correct 326 ms 50552 KB Output is correct
65 Incorrect 329 ms 50656 KB Output isn't correct
66 Incorrect 324 ms 50552 KB Output isn't correct
67 Incorrect 340 ms 50696 KB Output isn't correct
68 Incorrect 329 ms 50680 KB Output isn't correct
69 Correct 328 ms 50668 KB Output is correct
70 Incorrect 208 ms 40568 KB Output isn't correct
71 Incorrect 344 ms 50516 KB Output isn't correct
72 Incorrect 370 ms 50680 KB Output isn't correct
73 Incorrect 327 ms 50680 KB Output isn't correct
74 Incorrect 325 ms 50680 KB Output isn't correct
75 Incorrect 332 ms 50652 KB Output isn't correct
76 Incorrect 328 ms 50532 KB Output isn't correct
77 Incorrect 327 ms 50296 KB Output isn't correct
78 Incorrect 335 ms 50424 KB Output isn't correct
79 Incorrect 322 ms 50300 KB Output isn't correct
80 Incorrect 345 ms 50296 KB Output isn't correct
81 Incorrect 323 ms 50168 KB Output isn't correct
82 Incorrect 325 ms 50340 KB Output isn't correct
83 Incorrect 326 ms 50308 KB Output isn't correct
84 Incorrect 323 ms 50296 KB Output isn't correct
85 Incorrect 325 ms 50296 KB Output isn't correct
86 Correct 330 ms 50296 KB Output is correct
87 Correct 333 ms 50316 KB Output is correct
88 Incorrect 338 ms 50296 KB Output isn't correct
89 Incorrect 332 ms 50296 KB Output isn't correct
90 Incorrect 209 ms 40316 KB Output isn't correct
91 Incorrect 331 ms 50276 KB Output isn't correct
92 Incorrect 329 ms 50292 KB Output isn't correct
93 Incorrect 335 ms 50300 KB Output isn't correct
94 Incorrect 345 ms 50168 KB Output isn't correct
95 Incorrect 324 ms 50296 KB Output isn't correct
96 Incorrect 325 ms 50224 KB Output isn't correct
97 Incorrect 330 ms 50168 KB Output isn't correct
98 Incorrect 332 ms 50272 KB Output isn't correct
99 Incorrect 329 ms 50168 KB Output isn't correct
100 Incorrect 330 ms 50424 KB Output isn't correct