Submission #833377

# Submission time Handle Problem Language Result Execution time Memory
833377 2023-08-22T05:07:50 Z vjudge1 Bomb (IZhO17_bomb) C++17
15 / 100
1000 ms 31052 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MX = 2505;

char inp[MX][MX];
int board[MX][MX];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    for(int i =1 ; i<= n ; i++)
    {
        for(int j =1 ; j <= m;j++)
        {
            cin >> inp[i][j];
            board[i][j] = inp[i][j] - '0';
            board[i][j] += board[i][j-1];
        }
    }
    for(int i =1 ; i<= n ; i++)
    {
        for(int j =1 ; j <= m;j++)
        {
            board[i][j] += board[i-1][j];
        }
    }
    // for(int i =1 ; i<= n ; i++)
    // {
    //     for(int j =1 ; j <= m;j++)
    //     {
    //         cout << board[i][j] <<" ";
    //     }
    //     cout << "\n";
    // }
    int ans = 0;
    for(int h = 1; h <= n; h++)
    {
        for(int w = 1; w <= m ; w++)
        {
            bool ok = 1;
            for(int i =1 ; i<= n ; i++)
            {
                for(int j =1 ; j <= m;j++)
                {
                    if(inp[i][j] != '1' || inp[i-1][j] == '1' || inp[i][j-1] == '1'){
                        continue;
                    }
                    int sum = board[i+h-1][j+w-1];
                    sum -= board[i-1][j+w-1];
                    sum -= board[i+h-1][j-1];
                    sum += board[i-1][j-1];
                    if(sum != h*w)
                    {
                        // if(h == 3 && w == 1){
                        //     cout << i << " " <<j ;
                        // }
                        ok = 0;
                        break;
                    }
                }
                if(!ok){
                    break;
                }
                
            }
            if(ok){
                ans = max(ans, h*w);
            }
         }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 9 ms 16404 KB Output is correct
4 Correct 8 ms 16468 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Incorrect 0 ms 340 KB Output isn't correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Incorrect 0 ms 340 KB Output isn't correct
10 Correct 0 ms 340 KB Output is correct
11 Incorrect 0 ms 340 KB Output isn't correct
12 Incorrect 1 ms 340 KB Output isn't correct
13 Incorrect 1 ms 340 KB Output isn't correct
14 Correct 0 ms 340 KB Output is correct
15 Incorrect 0 ms 340 KB Output isn't correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 1 ms 724 KB Output is correct
18 Correct 1 ms 724 KB Output is correct
19 Incorrect 3 ms 852 KB Output isn't correct
20 Incorrect 3 ms 852 KB Output isn't correct
21 Correct 1 ms 596 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
23 Incorrect 7 ms 980 KB Output isn't correct
24 Incorrect 2 ms 852 KB Output isn't correct
25 Incorrect 10 ms 980 KB Output isn't correct
26 Incorrect 23 ms 980 KB Output isn't correct
27 Incorrect 69 ms 2548 KB Output isn't correct
28 Incorrect 5 ms 2644 KB Output isn't correct
29 Execution timed out 1052 ms 3284 KB Time limit exceeded
30 Execution timed out 1057 ms 3796 KB Time limit exceeded
31 Incorrect 950 ms 3068 KB Output isn't correct
32 Incorrect 755 ms 3560 KB Output isn't correct
33 Execution timed out 1039 ms 3924 KB Time limit exceeded
34 Incorrect 10 ms 2900 KB Output isn't correct
35 Incorrect 404 ms 4020 KB Output isn't correct
36 Execution timed out 1061 ms 3924 KB Time limit exceeded
37 Incorrect 0 ms 468 KB Output isn't correct
38 Execution timed out 1084 ms 30948 KB Time limit exceeded
39 Incorrect 1 ms 340 KB Output isn't correct
40 Execution timed out 1050 ms 8916 KB Time limit exceeded
41 Correct 1 ms 340 KB Output is correct
42 Correct 18 ms 980 KB Output is correct
43 Execution timed out 1079 ms 30884 KB Time limit exceeded
44 Execution timed out 1047 ms 3924 KB Time limit exceeded
45 Execution timed out 1040 ms 30940 KB Time limit exceeded
46 Execution timed out 1044 ms 30908 KB Time limit exceeded
47 Execution timed out 1051 ms 30924 KB Time limit exceeded
48 Execution timed out 1051 ms 30856 KB Time limit exceeded
49 Execution timed out 1049 ms 30928 KB Time limit exceeded
50 Execution timed out 1066 ms 30856 KB Time limit exceeded
51 Execution timed out 1052 ms 30824 KB Time limit exceeded
52 Execution timed out 1072 ms 30940 KB Time limit exceeded
53 Execution timed out 1049 ms 30948 KB Time limit exceeded
54 Execution timed out 1057 ms 30936 KB Time limit exceeded
55 Execution timed out 1078 ms 30924 KB Time limit exceeded
56 Execution timed out 1045 ms 30924 KB Time limit exceeded
57 Execution timed out 1080 ms 30924 KB Time limit exceeded
58 Execution timed out 1054 ms 30836 KB Time limit exceeded
59 Execution timed out 1057 ms 31052 KB Time limit exceeded
60 Execution timed out 1060 ms 30928 KB Time limit exceeded
61 Execution timed out 1053 ms 30924 KB Time limit exceeded
62 Execution timed out 1054 ms 30924 KB Time limit exceeded
63 Execution timed out 1056 ms 30880 KB Time limit exceeded
64 Execution timed out 1072 ms 30828 KB Time limit exceeded
65 Execution timed out 1069 ms 30920 KB Time limit exceeded
66 Execution timed out 1072 ms 30928 KB Time limit exceeded
67 Execution timed out 1070 ms 30924 KB Time limit exceeded
68 Execution timed out 1065 ms 30924 KB Time limit exceeded
69 Execution timed out 1052 ms 30924 KB Time limit exceeded
70 Execution timed out 1053 ms 24780 KB Time limit exceeded
71 Execution timed out 1074 ms 30924 KB Time limit exceeded
72 Execution timed out 1067 ms 30924 KB Time limit exceeded
73 Execution timed out 1043 ms 30884 KB Time limit exceeded
74 Execution timed out 1062 ms 30924 KB Time limit exceeded
75 Execution timed out 1056 ms 30848 KB Time limit exceeded
76 Execution timed out 1051 ms 30928 KB Time limit exceeded
77 Execution timed out 1068 ms 30824 KB Time limit exceeded
78 Execution timed out 1044 ms 30924 KB Time limit exceeded
79 Execution timed out 1060 ms 30924 KB Time limit exceeded
80 Execution timed out 1061 ms 30948 KB Time limit exceeded
81 Execution timed out 1064 ms 30924 KB Time limit exceeded
82 Execution timed out 1068 ms 30924 KB Time limit exceeded
83 Execution timed out 1067 ms 30924 KB Time limit exceeded
84 Execution timed out 1053 ms 30924 KB Time limit exceeded
85 Execution timed out 1075 ms 30924 KB Time limit exceeded
86 Execution timed out 1049 ms 30924 KB Time limit exceeded
87 Execution timed out 1066 ms 30948 KB Time limit exceeded
88 Execution timed out 1045 ms 30924 KB Time limit exceeded
89 Execution timed out 1055 ms 30924 KB Time limit exceeded
90 Execution timed out 1050 ms 24780 KB Time limit exceeded
91 Execution timed out 1031 ms 30872 KB Time limit exceeded
92 Execution timed out 1053 ms 30932 KB Time limit exceeded
93 Execution timed out 1069 ms 30924 KB Time limit exceeded
94 Execution timed out 1040 ms 30888 KB Time limit exceeded
95 Execution timed out 1041 ms 30924 KB Time limit exceeded
96 Execution timed out 1057 ms 30824 KB Time limit exceeded
97 Execution timed out 1070 ms 30936 KB Time limit exceeded
98 Execution timed out 1041 ms 30844 KB Time limit exceeded
99 Execution timed out 1077 ms 30888 KB Time limit exceeded
100 Execution timed out 1059 ms 30924 KB Time limit exceeded