Submission #38378

# Submission time Handle Problem Language Result Execution time Memory
38378 2018-01-04T04:34:26 Z antimirage Bomb (IZhO17_bomb) C++14
3 / 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];

bool FL = true;

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 = h; i <= n; i++)
    {
        for  (int j = w; 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;
            if (ar[i][j] == 1)
                FL = false;
        }
    }

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

Compilation message

bomb.cpp:77:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main ()
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:85:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
                    ^
bomb.cpp:89: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 Incorrect 0 ms 2504 KB Output isn't correct
2 Incorrect 0 ms 2504 KB Output isn't 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 Incorrect 0 ms 2504 KB Output isn't correct
9 Incorrect 0 ms 2504 KB Output isn't correct
10 Correct 0 ms 2504 KB Output is correct
11 Incorrect 0 ms 2504 KB Output isn't correct
12 Incorrect 0 ms 2504 KB Output isn't correct
13 Incorrect 0 ms 2504 KB Output isn't correct
14 Correct 0 ms 2504 KB Output is correct
15 Incorrect 0 ms 2504 KB Output isn't correct
16 Incorrect 0 ms 2504 KB Output isn't correct
17 Incorrect 46 ms 2504 KB Output isn't correct
18 Incorrect 23 ms 2504 KB Output isn't correct
19 Incorrect 89 ms 2504 KB Output isn't correct
20 Incorrect 93 ms 2504 KB Output isn't correct
21 Incorrect 26 ms 2504 KB Output isn't correct
22 Incorrect 63 ms 2504 KB Output isn't correct
23 Incorrect 253 ms 2504 KB Output isn't correct
24 Incorrect 86 ms 2504 KB Output isn't correct
25 Incorrect 636 ms 2504 KB Output isn't 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 Incorrect 0 ms 2504 KB Output isn't correct
38 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
39 Incorrect 0 ms 2504 KB Output isn't correct
40 Runtime error 0 ms 2508 KB Execution killed because of forbidden syscall gettid (186)
41 Incorrect 0 ms 2504 KB Output isn't 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)