Submission #38381

# Submission time Handle Problem Language Result Execution time Memory
38381 2018-01-04T04:35:55 Z antimirage Bomb (IZhO17_bomb) C++14
24 / 100
1000 ms 2508 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;

    assert(n <= 100 && m <= 100);

    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:83:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
                    ^
bomb.cpp:87: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 2508 KB Execution killed because of forbidden syscall gettid (186)
4 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
5 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
6 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
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 3 ms 2504 KB Output is correct
17 Correct 69 ms 2504 KB Output is correct
18 Correct 26 ms 2504 KB Output is correct
19 Correct 99 ms 2504 KB Output is correct
20 Correct 99 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 329 ms 2504 KB Output is correct
24 Correct 76 ms 2504 KB Output is correct
25 Correct 696 ms 2504 KB Output is correct
26 Execution timed out 1000 ms 2504 KB Execution timed out
27 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
28 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
29 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
30 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
31 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
32 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
33 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
34 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
35 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
36 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
37 Correct 0 ms 2504 KB Output is correct
38 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
39 Correct 0 ms 2504 KB Output is correct
40 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
41 Correct 0 ms 2504 KB Output is correct
42 Execution timed out 1000 ms 2504 KB Execution timed out
43 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
44 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
45 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
46 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
47 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
48 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
49 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
50 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
51 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
52 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
53 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
54 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
55 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
56 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
57 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
58 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
59 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
60 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
61 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
62 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
63 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
64 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
65 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
66 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
67 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
68 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
69 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
70 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
71 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
72 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
73 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
74 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
75 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
76 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
77 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
78 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
79 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
80 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
81 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
82 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
83 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
84 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
85 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
86 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
87 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
88 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
89 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
90 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
91 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
92 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
93 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
94 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
95 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
96 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
97 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
98 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
99 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
100 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)