답안 #173128

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
173128 2020-01-03T12:14:38 Z VEGAnn Bomb (IZhO17_bomb) C++14
4 / 100
1000 ms 55672 KB
#include <bits/stdc++.h>
//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define MP make_pair
#define ft first
#define sd second
#define pii pair<int, int>
#define PB push_back
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 2510;
const int oo = 2e9;
int n, m, ans, a[N][N], mx = oo, pr[N][N], best[N];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
//    freopen("in.txt","r",stdin);
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++){
        char c; cin >> c;
        a[i][j] = (c == '1' ? 1 : 0);
    }

    for (int j = 1; j <= m; j++){
        for (int i = 1; i <= n; ){
            if (a[i][j] == 0)
                i++;
            else {
                int i1 = i;
                while (i1 <= n && a[i1][j] == 1)
                    i1++;
                mx = min(mx, i1 - i);
                i = i1;
            }
        }
    }

    fill(best, best + n + 1, oo);

    for (int i = 1; i <= n; i++){
        int pre = 0;
        for (int j = 1; j <= m; j++){
            if (a[i][j] == 1)
                pre = j;
            pr[i][j] = pre;
        }
    }

    for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
        bool was = 0;
        int mn = oo;
        for (int h = 1; h <= mx; h++){
            if (i < h) break;
            int ii = i - h + 1;
            was |= (j == m || a[ii][j + 1] == 0);
            if (a[ii][j] == 0) break;
            mn = min(mn, j - pr[ii][j] + 1);
            if (was)
                best[h] = min(best[h], mn);
        }
    }

    for (int i = 1; i <= mx; i++)
        ans = max(ans, best[i] * i);

    cout << ans << '\n';

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 17 ms 20444 KB Output is correct
4 Correct 18 ms 20444 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 504 KB Output isn't correct
9 Incorrect 2 ms 504 KB Output isn't correct
10 Incorrect 2 ms 504 KB Output isn't correct
11 Incorrect 2 ms 504 KB Output isn't correct
12 Correct 2 ms 508 KB Output is correct
13 Incorrect 2 ms 504 KB Output isn't correct
14 Incorrect 2 ms 504 KB Output isn't correct
15 Incorrect 2 ms 632 KB Output isn't correct
16 Incorrect 2 ms 504 KB Output isn't correct
17 Incorrect 3 ms 888 KB Output isn't correct
18 Incorrect 3 ms 1060 KB Output isn't correct
19 Incorrect 3 ms 1144 KB Output isn't correct
20 Incorrect 3 ms 1144 KB Output isn't correct
21 Incorrect 2 ms 764 KB Output isn't correct
22 Incorrect 3 ms 1016 KB Output isn't correct
23 Incorrect 3 ms 1272 KB Output isn't correct
24 Incorrect 3 ms 1016 KB Output isn't correct
25 Incorrect 3 ms 1272 KB Output isn't correct
26 Incorrect 3 ms 1272 KB Output isn't correct
27 Incorrect 6 ms 3448 KB Output isn't correct
28 Incorrect 6 ms 3704 KB Output isn't correct
29 Incorrect 30 ms 4600 KB Output isn't correct
30 Incorrect 16 ms 5496 KB Output isn't correct
31 Incorrect 11 ms 4344 KB Output isn't correct
32 Incorrect 12 ms 4984 KB Output isn't correct
33 Incorrect 25 ms 5752 KB Output isn't correct
34 Incorrect 6 ms 3960 KB Output isn't correct
35 Incorrect 10 ms 5752 KB Output isn't correct
36 Incorrect 45 ms 5880 KB Output isn't correct
37 Incorrect 2 ms 504 KB Output isn't correct
38 Execution timed out 1079 ms 50680 KB Time limit exceeded
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 856 ms 14200 KB Output isn't correct
41 Incorrect 2 ms 504 KB Output isn't correct
42 Incorrect 3 ms 1272 KB Output isn't correct
43 Execution timed out 1085 ms 51576 KB Time limit exceeded
44 Incorrect 77 ms 5752 KB Output isn't correct
45 Execution timed out 1071 ms 54876 KB Time limit exceeded
46 Incorrect 351 ms 51932 KB Output isn't correct
47 Execution timed out 1089 ms 51320 KB Time limit exceeded
48 Incorrect 789 ms 51964 KB Output isn't correct
49 Incorrect 294 ms 52604 KB Output isn't correct
50 Incorrect 871 ms 55672 KB Output isn't correct
51 Incorrect 858 ms 50296 KB Output isn't correct
52 Incorrect 906 ms 50172 KB Output isn't correct
53 Incorrect 831 ms 50168 KB Output isn't correct
54 Incorrect 559 ms 50084 KB Output isn't correct
55 Incorrect 528 ms 50164 KB Output isn't correct
56 Execution timed out 1094 ms 50040 KB Time limit exceeded
57 Incorrect 471 ms 50080 KB Output isn't correct
58 Incorrect 560 ms 50040 KB Output isn't correct
59 Incorrect 516 ms 50168 KB Output isn't correct
60 Incorrect 570 ms 50208 KB Output isn't correct
61 Incorrect 634 ms 50312 KB Output isn't correct
62 Execution timed out 1084 ms 50144 KB Time limit exceeded
63 Execution timed out 1080 ms 50040 KB Time limit exceeded
64 Execution timed out 1088 ms 50148 KB Time limit exceeded
65 Incorrect 902 ms 50284 KB Output isn't correct
66 Incorrect 276 ms 50168 KB Output isn't correct
67 Incorrect 781 ms 50756 KB Output isn't correct
68 Incorrect 877 ms 50808 KB Output isn't correct
69 Incorrect 440 ms 50680 KB Output isn't correct
70 Incorrect 526 ms 40952 KB Output isn't correct
71 Execution timed out 1077 ms 50632 KB Time limit exceeded
72 Execution timed out 1027 ms 50680 KB Time limit exceeded
73 Execution timed out 1087 ms 50680 KB Time limit exceeded
74 Execution timed out 1079 ms 50344 KB Time limit exceeded
75 Execution timed out 1069 ms 50324 KB Time limit exceeded
76 Execution timed out 1074 ms 50296 KB Time limit exceeded
77 Execution timed out 1075 ms 50084 KB Time limit exceeded
78 Execution timed out 1076 ms 50164 KB Time limit exceeded
79 Incorrect 207 ms 50796 KB Output isn't correct
80 Incorrect 244 ms 51320 KB Output isn't correct
81 Incorrect 294 ms 51960 KB Output isn't correct
82 Execution timed out 1062 ms 52364 KB Time limit exceeded
83 Execution timed out 1068 ms 52448 KB Time limit exceeded
84 Incorrect 196 ms 52600 KB Output isn't correct
85 Execution timed out 1081 ms 52956 KB Time limit exceeded
86 Incorrect 973 ms 53368 KB Output isn't correct
87 Execution timed out 1082 ms 53752 KB Time limit exceeded
88 Execution timed out 1083 ms 53864 KB Time limit exceeded
89 Execution timed out 1084 ms 54020 KB Time limit exceeded
90 Execution timed out 1074 ms 42360 KB Time limit exceeded
91 Execution timed out 1082 ms 54560 KB Time limit exceeded
92 Execution timed out 1078 ms 54656 KB Time limit exceeded
93 Execution timed out 1088 ms 54760 KB Time limit exceeded
94 Execution timed out 1082 ms 54908 KB Time limit exceeded
95 Execution timed out 1082 ms 55032 KB Time limit exceeded
96 Execution timed out 1076 ms 55160 KB Time limit exceeded
97 Execution timed out 1086 ms 55480 KB Time limit exceeded
98 Execution timed out 1069 ms 55516 KB Time limit exceeded
99 Execution timed out 1080 ms 55644 KB Time limit exceeded
100 Execution timed out 1080 ms 55416 KB Time limit exceeded