Submission #38368

# Submission time Handle Problem Language Result Execution time Memory
38368 2018-01-04T04:26:13 Z antimirage Bomb (IZhO17_bomb) C++14
26 / 100
1000 ms 2504 KB
#include <iostream>
#include <vector>
#include <deque>
#include <math.h>
#include <set>
#include <iomanip>
#include <time.h>
#include <list>
#include <stdio.h>
#include <queue>
#include <map>
#include <algorithm>
#include <assert.h>
#include <memory.h>

#define mk make_pair
#define sc second
#define fr first
#define pb emplace_back
#define all(s) s.begin(), s.end()
#define sz(s) ( (int)s.size() )

using namespace std;

const int N = 250;

int n, m, ans;

int u[N][N], ar[N][N];

inline bool check(int w, int h)
{
    for (int i = 1; i <= n; i++)
        for (int j = 1;  j <= m; j++)
            u[i][j] = ar[i][j];

    for (int i = w; i <= n; i++)
    {
        for  (int j = h; j <= m; j++)
        {
            if (ar[i][j] == 1)
            {
                bool fl = false;

                for (int k = i - w + 1; k <= i; k++)
                {
                    for (int l = j - h + 1; l <= j; l++)
                    {
                        if (u[k][l] == 0)
                        {
                            fl = true;
                            break;
                        }
                    }
                    if (fl) break;
                }
                if (!fl)
                {
                    for (int k = i - w + 1; k <= i; k++)
                        for (int l = j - h + 1; l <= j; l++)
                            u[k][l] = -1;
                }
            }
        }
    }
    for (int i = 1; i <= n; i++)
        for (int j = 1;  j <= m; j++)
        {
            if (u[i][j] == 1)
                return false;
        }
    return true;
}

main ()
{
    cin >> n >> m;

    for (int i = 1; i <= n; i++)
    {
        scanf("\n");
        for (int j = 1;  j <= m; j++)
        {
            char ch;
            scanf("%c", &ch);
            ar[i][j] = ch - 48;
        }
    }

    for (int i = 1; i <= n; i++)
    {
        for (int j = 1; j <= m; j++)
        {
            if (check(i, j))
                ans = max(ans, i * j);
        }
    }
    cout << ans << endl;
}

Compilation message

bomb.cpp:75:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main ()
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:81:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
                    ^
bomb.cpp:85:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%c", &ch);
                             ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2504 KB Output is correct
2 Correct 0 ms 2504 KB Output is correct
3 Runtime error 0 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 0 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Correct 499 ms 2504 KB Output is correct
6 Correct 179 ms 2504 KB Output is correct
7 Correct 0 ms 2504 KB Output is correct
8 Correct 0 ms 2504 KB Output is correct
9 Correct 0 ms 2504 KB Output is correct
10 Correct 0 ms 2504 KB Output is correct
11 Correct 0 ms 2504 KB Output is correct
12 Correct 0 ms 2504 KB Output is correct
13 Correct 0 ms 2504 KB Output is correct
14 Correct 0 ms 2504 KB Output is correct
15 Correct 0 ms 2504 KB Output is correct
16 Correct 0 ms 2504 KB Output is correct
17 Correct 63 ms 2504 KB Output is correct
18 Correct 26 ms 2504 KB Output is correct
19 Correct 93 ms 2504 KB Output is correct
20 Correct 123 ms 2504 KB Output is correct
21 Correct 26 ms 2504 KB Output is correct
22 Correct 63 ms 2504 KB Output is correct
23 Correct 323 ms 2504 KB Output is correct
24 Correct 73 ms 2504 KB Output is correct
25 Correct 793 ms 2504 KB Output is correct
26 Execution timed out 1000 ms 2504 KB Execution timed out
27 Runtime error 0 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 3 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 6 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 9 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 6 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 0 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 9 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 9 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Correct 0 ms 2504 KB Output is correct
38 Runtime error 66 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Correct 0 ms 2504 KB Output is correct
40 Runtime error 16 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
41 Correct 0 ms 2504 KB Output is correct
42 Execution timed out 1000 ms 2504 KB Execution timed out
43 Incorrect 53 ms 2504 KB Output isn't correct
44 Runtime error 6 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
45 Runtime error 53 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
46 Incorrect 53 ms 2504 KB Output isn't correct
47 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
48 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
49 Runtime error 63 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
50 Runtime error 66 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
51 Runtime error 46 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
52 Runtime error 63 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
53 Runtime error 56 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
54 Runtime error 53 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
55 Runtime error 63 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
56 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
57 Runtime error 49 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
58 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
59 Runtime error 66 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
60 Runtime error 53 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
61 Runtime error 56 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
62 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
63 Runtime error 49 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
64 Runtime error 53 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
65 Runtime error 56 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
66 Runtime error 53 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
67 Runtime error 56 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
68 Runtime error 76 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
69 Runtime error 66 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
70 Incorrect 46 ms 2504 KB Output isn't correct
71 Incorrect 86 ms 2504 KB Output isn't correct
72 Incorrect 76 ms 2504 KB Output isn't correct
73 Incorrect 56 ms 2504 KB Output isn't correct
74 Incorrect 69 ms 2504 KB Output isn't correct
75 Incorrect 53 ms 2504 KB Output isn't correct
76 Incorrect 53 ms 2504 KB Output isn't correct
77 Incorrect 63 ms 2504 KB Output isn't correct
78 Incorrect 69 ms 2504 KB Output isn't correct
79 Incorrect 63 ms 2504 KB Output isn't correct
80 Incorrect 56 ms 2504 KB Output isn't correct
81 Incorrect 63 ms 2504 KB Output isn't correct
82 Incorrect 63 ms 2504 KB Output isn't correct
83 Incorrect 49 ms 2504 KB Output isn't correct
84 Incorrect 53 ms 2504 KB Output isn't correct
85 Incorrect 59 ms 2504 KB Output isn't correct
86 Runtime error 63 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
87 Incorrect 59 ms 2504 KB Output isn't correct
88 Incorrect 69 ms 2504 KB Output isn't correct
89 Incorrect 53 ms 2504 KB Output isn't correct
90 Incorrect 46 ms 2504 KB Output isn't correct
91 Incorrect 63 ms 2504 KB Output isn't correct
92 Incorrect 53 ms 2504 KB Output isn't correct
93 Runtime error 66 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
94 Incorrect 49 ms 2504 KB Output isn't correct
95 Incorrect 53 ms 2504 KB Output isn't correct
96 Incorrect 63 ms 2504 KB Output isn't correct
97 Runtime error 63 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
98 Incorrect 56 ms 2504 KB Output isn't correct
99 Incorrect 53 ms 2504 KB Output isn't correct
100 Runtime error 59 ms 2504 KB Execution killed with signal 11 (could be triggered by violating memory limits)