Submission #38391

# Submission time Handle Problem Language Result Execution time Memory
38391 2018-01-04T04:59:51 Z Just_Solve_The_Problem Bomb (IZhO17_bomb) C++11
0 / 100
0 ms 8144 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int)2505;

char c[N][N];

main () {
    #define NAME "bomb"
    freopen(NAME".in", "r", stdin);
    freopen(NAME".out", "w", stdout);
    int n, m; scanf ("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            char ss; ss = getchar();
            if (ss == '\n')
                j--;
            else
                c[i][j] = ss;
        }
    }
    int h = N;
    int w = N;
    for (int i = 1; i <= n; i++) {
        int res = 0;
        for (int j = 1; j <= m; j++) {
            if (c[i][j] == '0' && res != 0) {
                w = min(w, res);
                res = 0;
            }
            if (c[i][j] == '1')
                res++;
        }
        if (res != 0)
            w = min(w, res);
    }
    for (int i = 1; i <= m; i++) {
        int res = 0;
        for (int j = 1; j <= n; j++) {
            if (c[j][i] == '0' && res != 0) {
                h = min(h, res);
                res = 0;
            }
            if (c[j][i] == '1')
                res++;
//            cout << j << ' ' << i << ' ' << res <<  endl;
        }
        if (res != 0)
            h = min(h, res);
    }
//    cout << h << ' ' << w << endl;
    cout << h * w;
}

Compilation message

bomb.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:11:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(NAME".in", "r", stdin);
                                   ^
bomb.cpp:12:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(NAME".out", "w", stdout);
                                     ^
bomb.cpp:13:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, m; scanf ("%d %d", &n, &m);
                                      ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
3 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
4 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
5 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
6 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
7 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
8 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
9 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
10 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
11 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
12 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
13 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
14 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
15 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
16 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
17 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
18 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
19 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
20 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
21 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
22 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
23 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
24 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
25 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
26 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
27 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
28 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
29 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
30 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
31 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
32 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
33 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
34 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
35 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
36 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
37 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
38 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
39 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
40 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
41 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
42 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
43 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
44 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
45 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
46 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
47 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
48 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
49 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
50 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
51 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
52 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
53 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
54 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
55 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
56 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
57 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
58 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
59 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
60 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
61 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
62 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
63 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
64 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
65 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
66 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
67 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
68 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
69 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
70 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
71 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
72 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
73 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
74 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
75 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
76 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
77 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
78 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
79 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
80 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
81 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
82 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
83 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
84 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
85 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
86 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
87 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
88 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
89 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
90 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
91 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
92 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
93 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
94 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
95 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
96 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
97 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
98 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
99 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
100 Runtime error 0 ms 8144 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)