Submission #833301

# Submission time Handle Problem Language Result Execution time Memory
833301 2023-08-22T04:18:07 Z vjudge1 Bomb (IZhO17_bomb) C++17
0 / 100
86 ms 100240 KB
/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <bits/stdc++.h>

using namespace std;

const int N = 3e3;

int markas[N][N];
int jarak[N][N];
int jarakKiri[N][N];
bool ada = true;
int mn[N];
int mx = 0;


void solve(){
    int n, m;
    cin >> n >> m;
    memset(jarak, 0, sizeof(jarak));
    memset(jarakKiri, 0, sizeof(jarakKiri));
    memset(mn, -1, sizeof(mn));
    int mnPjg = n*m;
    for(int i = 1; i <= n; i++){
        string s;
        cin >> s;
        for(int j = 1; j <= m; j++){
            markas[i][j] = s[j - 1] - '0';
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = m; j >= 1; j--){
            jarak[i][j] = jarak[i][j + 1] + 1;
            if(!markas[i][j]){
                jarak[i][j] = 0;
            }
        }
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            jarakKiri[i][j] = jarakKiri[i][j - 1] + 1;
            if(!markas[i][j]){
                jarakKiri[i][j] = 0;
            }
        }
    }
    

    
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(markas[i][j] == 1 && markas[i - 1][j] == 0 && markas[i][j - 1] == 0){
                int k = i;
                int curP = jarak[k][j];
                mnPjg = min(mnPjg, curP);
                while(curP != 0){
                    if(mn[k - i + 1] == -1){
                        mn[k - i + 1] = curP;
                    }else{
                        mn[k - i + 1] = min(mn[k - i + 1], curP);
                    }
                    k++;
                    curP = min(curP, jarak[k][j]);
                }
                mn[k - i + 1] = 0;
            }
            if(markas[i][j] == 1 && markas[i + 1][j] == 0 && markas[i][j + 1] == 0){
                int k = i;
                int curP = jarak[k][j];
                while(curP != 0){
                    if(mn[i - k + 1] == -1){
                        mn[i - k + 1] = curP;
                    }else{
                        mn[i - k + 1] = min(mn[i - k + 1], curP);
                    }
                    k--;
                    curP = min(curP, jarak[k][j]);
                }
                mn[i - k + 1] = 0;
            }
        }
    }
    
    mx = mn[1];
    for(int i = 2; i <= m; i++){
        mn[i] = min(mn[i], mn[i - 1]);
        mx = max(mx, i * mn[i]);
    }
    cout << mx << endl;
    
    
    
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t = 1;
    while(t--){
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 70740 KB Output isn't correct
2 Incorrect 24 ms 70848 KB Output isn't correct
3 Incorrect 27 ms 80816 KB Output isn't correct
4 Incorrect 27 ms 80724 KB Output isn't correct
5 Incorrect 24 ms 70740 KB Output isn't correct
6 Incorrect 23 ms 70684 KB Output isn't correct
7 Incorrect 24 ms 70720 KB Output isn't correct
8 Incorrect 24 ms 70832 KB Output isn't correct
9 Incorrect 25 ms 70752 KB Output isn't correct
10 Incorrect 23 ms 70728 KB Output isn't correct
11 Incorrect 23 ms 70868 KB Output isn't correct
12 Incorrect 24 ms 70740 KB Output isn't correct
13 Incorrect 24 ms 70740 KB Output isn't correct
14 Incorrect 24 ms 70852 KB Output isn't correct
15 Incorrect 24 ms 70812 KB Output isn't correct
16 Incorrect 23 ms 70868 KB Output isn't correct
17 Incorrect 24 ms 70988 KB Output isn't correct
18 Incorrect 24 ms 70996 KB Output isn't correct
19 Incorrect 24 ms 71116 KB Output isn't correct
20 Incorrect 25 ms 71124 KB Output isn't correct
21 Incorrect 24 ms 70988 KB Output isn't correct
22 Incorrect 24 ms 71124 KB Output isn't correct
23 Incorrect 24 ms 71124 KB Output isn't correct
24 Incorrect 25 ms 71032 KB Output isn't correct
25 Incorrect 25 ms 71124 KB Output isn't correct
26 Incorrect 24 ms 71124 KB Output isn't correct
27 Incorrect 25 ms 72276 KB Output isn't correct
28 Incorrect 26 ms 72276 KB Output isn't correct
29 Incorrect 25 ms 72780 KB Output isn't correct
30 Incorrect 25 ms 73172 KB Output isn't correct
31 Incorrect 25 ms 72660 KB Output isn't correct
32 Incorrect 25 ms 72916 KB Output isn't correct
33 Incorrect 27 ms 73300 KB Output isn't correct
34 Incorrect 26 ms 72532 KB Output isn't correct
35 Incorrect 25 ms 73300 KB Output isn't correct
36 Incorrect 27 ms 73300 KB Output isn't correct
37 Incorrect 25 ms 70868 KB Output isn't correct
38 Incorrect 80 ms 100044 KB Output isn't correct
39 Incorrect 29 ms 70732 KB Output isn't correct
40 Incorrect 34 ms 77396 KB Output isn't correct
41 Incorrect 25 ms 70868 KB Output isn't correct
42 Incorrect 24 ms 71124 KB Output isn't correct
43 Incorrect 86 ms 100044 KB Output isn't correct
44 Incorrect 32 ms 73300 KB Output isn't correct
45 Incorrect 84 ms 100168 KB Output isn't correct
46 Incorrect 73 ms 100104 KB Output isn't correct
47 Incorrect 79 ms 100172 KB Output isn't correct
48 Incorrect 82 ms 100168 KB Output isn't correct
49 Incorrect 84 ms 100168 KB Output isn't correct
50 Incorrect 73 ms 100096 KB Output isn't correct
51 Incorrect 73 ms 100172 KB Output isn't correct
52 Incorrect 75 ms 100044 KB Output isn't correct
53 Incorrect 71 ms 100044 KB Output isn't correct
54 Incorrect 66 ms 100172 KB Output isn't correct
55 Incorrect 68 ms 100164 KB Output isn't correct
56 Incorrect 80 ms 100156 KB Output isn't correct
57 Incorrect 65 ms 100044 KB Output isn't correct
58 Incorrect 66 ms 100044 KB Output isn't correct
59 Incorrect 65 ms 100080 KB Output isn't correct
60 Incorrect 70 ms 100112 KB Output isn't correct
61 Incorrect 84 ms 100132 KB Output isn't correct
62 Incorrect 81 ms 100164 KB Output isn't correct
63 Incorrect 81 ms 100168 KB Output isn't correct
64 Incorrect 67 ms 100168 KB Output isn't correct
65 Incorrect 74 ms 100164 KB Output isn't correct
66 Incorrect 72 ms 100076 KB Output isn't correct
67 Incorrect 74 ms 100168 KB Output isn't correct
68 Incorrect 79 ms 100168 KB Output isn't correct
69 Incorrect 66 ms 100044 KB Output isn't correct
70 Incorrect 51 ms 94208 KB Output isn't correct
71 Incorrect 66 ms 100168 KB Output isn't correct
72 Incorrect 60 ms 100216 KB Output isn't correct
73 Incorrect 68 ms 100164 KB Output isn't correct
74 Incorrect 66 ms 100172 KB Output isn't correct
75 Incorrect 63 ms 100164 KB Output isn't correct
76 Incorrect 66 ms 100168 KB Output isn't correct
77 Incorrect 67 ms 100080 KB Output isn't correct
78 Incorrect 66 ms 100160 KB Output isn't correct
79 Incorrect 63 ms 100212 KB Output isn't correct
80 Incorrect 59 ms 100168 KB Output isn't correct
81 Incorrect 61 ms 100120 KB Output isn't correct
82 Incorrect 68 ms 100180 KB Output isn't correct
83 Incorrect 67 ms 100044 KB Output isn't correct
84 Incorrect 61 ms 100116 KB Output isn't correct
85 Incorrect 68 ms 100164 KB Output isn't correct
86 Incorrect 81 ms 100164 KB Output isn't correct
87 Incorrect 65 ms 100180 KB Output isn't correct
88 Incorrect 67 ms 100044 KB Output isn't correct
89 Incorrect 71 ms 100044 KB Output isn't correct
90 Incorrect 53 ms 94292 KB Output isn't correct
91 Incorrect 70 ms 100240 KB Output isn't correct
92 Incorrect 76 ms 100164 KB Output isn't correct
93 Incorrect 83 ms 100176 KB Output isn't correct
94 Incorrect 69 ms 100044 KB Output isn't correct
95 Incorrect 64 ms 100180 KB Output isn't correct
96 Incorrect 65 ms 100116 KB Output isn't correct
97 Incorrect 78 ms 100180 KB Output isn't correct
98 Incorrect 63 ms 100056 KB Output isn't correct
99 Incorrect 68 ms 100180 KB Output isn't correct
100 Incorrect 76 ms 100044 KB Output isn't correct