Submission #170163

# Submission time Handle Problem Language Result Execution time Memory
170163 2019-12-24T06:23:54 Z dxz05 Bomb (IZhO17_bomb) C++14
11 / 100
1000 ms 12784 KB
#include <bits/stdc++.h>

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1e9;
const int MOD = 1000000007;
const int N = 2002055;
const int M = 2511;

char a[M][M];

void solve() {
    int n, m;
    cin >> n >> m;

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            cin >> a[i][j];
        }
    }

    int A = INF, B = INF;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (a[i][j] == '0') continue;
            int x = 1, y = 1;
            for (int k = i + 1; k <= n; k++) {
                if (a[k][j] == '1') x++;
                else
                    break;
            }
            for (int k = i - 1; k >= 1; k--) {
                if (a[k][j] == '1') x++;
                else
                    break;
            }
            for (int k = j + 1; k <= n; k++) {
                if (a[i][k] == '1') y++;
                else
                    break;
            }
            for (int k = j - 1; k >= 1; k--) {
                if (a[i][k] == '1') y++;
                else
                    break;
            }
            A = min(A, x);
            B = min(B, y);
        }
    }

    cout << A * B;

}

int main() {
    ios_base::sync_with_stdio(false);
#ifdef dxz05
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else

#endif

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 380 KB Output isn't correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 11 ms 6520 KB Output is correct
4 Correct 9 ms 6520 KB Output is correct
5 Incorrect 2 ms 424 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Correct 2 ms 380 KB Output is correct
17 Incorrect 2 ms 504 KB Output isn't correct
18 Incorrect 2 ms 504 KB Output isn't correct
19 Incorrect 2 ms 504 KB Output isn't correct
20 Incorrect 3 ms 504 KB Output isn't correct
21 Incorrect 3 ms 504 KB Output isn't correct
22 Incorrect 3 ms 504 KB Output isn't correct
23 Incorrect 2 ms 632 KB Output isn't correct
24 Incorrect 2 ms 504 KB Output isn't correct
25 Incorrect 3 ms 632 KB Output isn't correct
26 Correct 4 ms 632 KB Output is correct
27 Correct 39 ms 1144 KB Output is correct
28 Incorrect 5 ms 1196 KB Output isn't correct
29 Incorrect 64 ms 1400 KB Output isn't correct
30 Incorrect 19 ms 1784 KB Output isn't correct
31 Incorrect 12 ms 1272 KB Output isn't correct
32 Incorrect 10 ms 1524 KB Output isn't correct
33 Incorrect 28 ms 1656 KB Output isn't correct
34 Incorrect 4 ms 1272 KB Output isn't correct
35 Incorrect 9 ms 1656 KB Output isn't correct
36 Correct 187 ms 1728 KB Output is correct
37 Incorrect 2 ms 508 KB Output isn't correct
38 Execution timed out 1070 ms 12620 KB Time limit exceeded
39 Incorrect 2 ms 376 KB Output isn't correct
40 Incorrect 960 ms 3420 KB Output isn't correct
41 Incorrect 2 ms 376 KB Output isn't correct
42 Incorrect 3 ms 632 KB Output isn't correct
43 Execution timed out 1082 ms 12536 KB Time limit exceeded
44 Incorrect 83 ms 1612 KB Output isn't correct
45 Execution timed out 1074 ms 12636 KB Time limit exceeded
46 Correct 303 ms 12640 KB Output is correct
47 Execution timed out 1081 ms 12692 KB Time limit exceeded
48 Execution timed out 1069 ms 12664 KB Time limit exceeded
49 Execution timed out 1076 ms 12664 KB Time limit exceeded
50 Execution timed out 1081 ms 12536 KB Time limit exceeded
51 Execution timed out 1086 ms 12536 KB Time limit exceeded
52 Execution timed out 1070 ms 12596 KB Time limit exceeded
53 Execution timed out 1075 ms 12664 KB Time limit exceeded
54 Execution timed out 1078 ms 12664 KB Time limit exceeded
55 Execution timed out 1079 ms 12636 KB Time limit exceeded
56 Execution timed out 1076 ms 12536 KB Time limit exceeded
57 Execution timed out 1078 ms 12664 KB Time limit exceeded
58 Execution timed out 1063 ms 12544 KB Time limit exceeded
59 Execution timed out 1071 ms 12688 KB Time limit exceeded
60 Execution timed out 1076 ms 12632 KB Time limit exceeded
61 Execution timed out 1072 ms 12664 KB Time limit exceeded
62 Execution timed out 1083 ms 12540 KB Time limit exceeded
63 Execution timed out 1086 ms 12536 KB Time limit exceeded
64 Execution timed out 1083 ms 12536 KB Time limit exceeded
65 Execution timed out 1059 ms 12668 KB Time limit exceeded
66 Execution timed out 1074 ms 12664 KB Time limit exceeded
67 Execution timed out 1068 ms 12664 KB Time limit exceeded
68 Execution timed out 1077 ms 12664 KB Time limit exceeded
69 Execution timed out 1066 ms 12664 KB Time limit exceeded
70 Incorrect 542 ms 9280 KB Output isn't correct
71 Execution timed out 1081 ms 12636 KB Time limit exceeded
72 Execution timed out 1049 ms 12532 KB Time limit exceeded
73 Execution timed out 1079 ms 12664 KB Time limit exceeded
74 Execution timed out 1059 ms 12552 KB Time limit exceeded
75 Execution timed out 1077 ms 12664 KB Time limit exceeded
76 Execution timed out 1071 ms 12536 KB Time limit exceeded
77 Execution timed out 1084 ms 12536 KB Time limit exceeded
78 Execution timed out 1080 ms 12664 KB Time limit exceeded
79 Incorrect 137 ms 12664 KB Output isn't correct
80 Incorrect 161 ms 12564 KB Output isn't correct
81 Incorrect 245 ms 12612 KB Output isn't correct
82 Execution timed out 1080 ms 12636 KB Time limit exceeded
83 Execution timed out 1066 ms 12664 KB Time limit exceeded
84 Incorrect 134 ms 12664 KB Output isn't correct
85 Execution timed out 1068 ms 12668 KB Time limit exceeded
86 Execution timed out 1074 ms 12708 KB Time limit exceeded
87 Execution timed out 1071 ms 12536 KB Time limit exceeded
88 Execution timed out 1081 ms 12536 KB Time limit exceeded
89 Execution timed out 1083 ms 12536 KB Time limit exceeded
90 Execution timed out 1079 ms 9080 KB Time limit exceeded
91 Execution timed out 1072 ms 12664 KB Time limit exceeded
92 Execution timed out 1067 ms 12548 KB Time limit exceeded
93 Execution timed out 1082 ms 12672 KB Time limit exceeded
94 Execution timed out 1058 ms 12668 KB Time limit exceeded
95 Execution timed out 1068 ms 12536 KB Time limit exceeded
96 Execution timed out 1070 ms 12664 KB Time limit exceeded
97 Execution timed out 1080 ms 12784 KB Time limit exceeded
98 Execution timed out 1069 ms 12684 KB Time limit exceeded
99 Execution timed out 1025 ms 12668 KB Time limit exceeded
100 Execution timed out 1034 ms 12528 KB Time limit exceeded