Submission #920196

# Submission time Handle Problem Language Result Execution time Memory
920196 2024-02-02T08:51:10 Z MilosMilutinovic Bomb (IZhO17_bomb) C++14
15 / 100
1000 ms 2904 KB
// Online C++ compiler to run C++ program online
#include<bits/stdc++.h>

using namespace std;

int n,m;
char s[25][25];
bool was[25][25];

bool check(int x,int y){
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            was[i][j]=false;
        }
    }
    for(int i=0;i+x<=n;i++){
        for(int j=0;j+y<=m;j++){
            bool ok=true;
            for(int a=i;a<i+x;a++){
                for(int b=j;b<j+y;b++){
                    if(s[a][b]=='0') ok=false;
                }
            }
            if(ok){
                for(int a=i;a<i+x;a++){
                    for(int b=j;b<j+y;b++){
                        was[a][b]=true;
                    }
                }   
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(s[i][j]=='1'&&!was[i][j]){
                return false;
            }
        }
    }
    return true;
}

int main(){
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++) scanf("%s",s[i]);
    int ans=0;
    for(int x=1;x<=n;x++){
        for(int y=1;y<=m;y++){
            if(check(x,y)) ans=max(ans,x*y);
        }
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:44:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |     scanf("%d%d",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~
bomb.cpp:45:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |     for(int i=0;i<n;i++) scanf("%s",s[i]);
      |                          ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Runtime error 1 ms 344 KB Execution killed with signal 11
5 Execution timed out 1048 ms 344 KB Time limit exceeded
6 Execution timed out 1050 ms 344 KB Time limit exceeded
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 2 ms 348 KB Output is correct
17 Execution timed out 1026 ms 344 KB Time limit exceeded
18 Execution timed out 1048 ms 344 KB Time limit exceeded
19 Execution timed out 1022 ms 344 KB Time limit exceeded
20 Execution timed out 1032 ms 344 KB Time limit exceeded
21 Execution timed out 1032 ms 344 KB Time limit exceeded
22 Execution timed out 1041 ms 348 KB Time limit exceeded
23 Execution timed out 1024 ms 344 KB Time limit exceeded
24 Execution timed out 1036 ms 344 KB Time limit exceeded
25 Execution timed out 1039 ms 344 KB Time limit exceeded
26 Execution timed out 1025 ms 344 KB Time limit exceeded
27 Execution timed out 1053 ms 344 KB Time limit exceeded
28 Execution timed out 1046 ms 344 KB Time limit exceeded
29 Execution timed out 1030 ms 344 KB Time limit exceeded
30 Execution timed out 1044 ms 600 KB Time limit exceeded
31 Execution timed out 1020 ms 344 KB Time limit exceeded
32 Execution timed out 1041 ms 344 KB Time limit exceeded
33 Execution timed out 1027 ms 600 KB Time limit exceeded
34 Execution timed out 1032 ms 456 KB Time limit exceeded
35 Execution timed out 1038 ms 600 KB Time limit exceeded
36 Execution timed out 1037 ms 600 KB Time limit exceeded
37 Correct 3 ms 600 KB Output is correct
38 Runtime error 6 ms 2648 KB Execution killed with signal 11
39 Correct 2 ms 344 KB Output is correct
40 Runtime error 2 ms 1112 KB Execution killed with signal 11
41 Correct 3 ms 344 KB Output is correct
42 Execution timed out 1030 ms 344 KB Time limit exceeded
43 Runtime error 5 ms 2648 KB Execution killed with signal 11
44 Execution timed out 1037 ms 600 KB Time limit exceeded
45 Runtime error 5 ms 2648 KB Execution killed with signal 11
46 Runtime error 6 ms 2652 KB Execution killed with signal 11
47 Runtime error 5 ms 2476 KB Execution killed with signal 11
48 Runtime error 5 ms 2648 KB Execution killed with signal 11
49 Runtime error 5 ms 2648 KB Execution killed with signal 11
50 Runtime error 5 ms 2652 KB Execution killed with signal 11
51 Runtime error 5 ms 2652 KB Execution killed with signal 11
52 Runtime error 5 ms 2648 KB Execution killed with signal 11
53 Runtime error 5 ms 2648 KB Execution killed with signal 11
54 Runtime error 6 ms 2648 KB Execution killed with signal 11
55 Runtime error 5 ms 2648 KB Execution killed with signal 11
56 Runtime error 5 ms 2648 KB Execution killed with signal 11
57 Runtime error 5 ms 2656 KB Execution killed with signal 11
58 Runtime error 5 ms 2648 KB Execution killed with signal 11
59 Runtime error 5 ms 2648 KB Execution killed with signal 11
60 Runtime error 6 ms 2588 KB Execution killed with signal 11
61 Runtime error 6 ms 2648 KB Execution killed with signal 11
62 Runtime error 5 ms 2652 KB Execution killed with signal 11
63 Runtime error 5 ms 2652 KB Execution killed with signal 11
64 Runtime error 5 ms 2720 KB Execution killed with signal 11
65 Runtime error 5 ms 2720 KB Execution killed with signal 11
66 Runtime error 6 ms 2564 KB Execution killed with signal 11
67 Runtime error 5 ms 2648 KB Execution killed with signal 11
68 Runtime error 6 ms 2640 KB Execution killed with signal 11
69 Runtime error 5 ms 2652 KB Execution killed with signal 11
70 Runtime error 4 ms 2140 KB Execution killed with signal 11
71 Runtime error 6 ms 2520 KB Execution killed with signal 11
72 Runtime error 5 ms 2652 KB Execution killed with signal 11
73 Runtime error 5 ms 2648 KB Execution killed with signal 11
74 Runtime error 5 ms 2648 KB Execution killed with signal 11
75 Runtime error 5 ms 2648 KB Execution killed with signal 11
76 Runtime error 6 ms 2648 KB Execution killed with signal 11
77 Runtime error 5 ms 2648 KB Execution killed with signal 11
78 Runtime error 5 ms 2648 KB Execution killed with signal 11
79 Runtime error 6 ms 2640 KB Execution killed with signal 11
80 Runtime error 6 ms 2652 KB Execution killed with signal 11
81 Runtime error 6 ms 2648 KB Execution killed with signal 11
82 Runtime error 5 ms 2648 KB Execution killed with signal 11
83 Runtime error 5 ms 2492 KB Execution killed with signal 11
84 Runtime error 5 ms 2640 KB Execution killed with signal 11
85 Runtime error 5 ms 2652 KB Execution killed with signal 11
86 Runtime error 5 ms 2648 KB Execution killed with signal 11
87 Runtime error 5 ms 2640 KB Execution killed with signal 11
88 Runtime error 5 ms 2904 KB Execution killed with signal 11
89 Runtime error 5 ms 2652 KB Execution killed with signal 11
90 Runtime error 5 ms 2140 KB Execution killed with signal 11
91 Runtime error 5 ms 2648 KB Execution killed with signal 11
92 Runtime error 5 ms 2652 KB Execution killed with signal 11
93 Runtime error 5 ms 2648 KB Execution killed with signal 11
94 Runtime error 6 ms 2596 KB Execution killed with signal 11
95 Runtime error 5 ms 2592 KB Execution killed with signal 11
96 Runtime error 5 ms 2648 KB Execution killed with signal 11
97 Runtime error 5 ms 2592 KB Execution killed with signal 11
98 Runtime error 5 ms 2648 KB Execution killed with signal 11
99 Runtime error 5 ms 2904 KB Execution killed with signal 11
100 Runtime error 5 ms 2652 KB Execution killed with signal 11