답안 #38944

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
38944 2018-01-08T09:00:20 Z touristk2000 Bomb (IZhO17_bomb) C++14
0 / 100
0 ms 49992 KB
#include <stdio.h>
const int maxn = 2501;
int dp[maxn][maxn];
int a[maxn][maxn];
int p[maxn];
int t;///;[maxn];
int n, m, res = 1;
bool check(int i, int j){
            for(int c = 1; c <= m; c ++) p[c] = n + 1;
            bool f = true;
            for(int I = n; I >= 1 && f; I --){
                int q = m + 1;
                for(int J = m; J >= 1 && f; J --){
                    if(I>=i&&J>=j){
                    if(dp[I][J] - dp[I-i][J] - dp[I][J-j] + dp[I-i][J-j] == i * j){
                        q = J - j;
                    }}
                    if(J > q) p[J] = I-i;
                    if(a[I][J] && p[J] >= I) f = false;
                }
            }
            return f;
}
int main(){
    freopen("bomb.in", "r", stdin);
    freopen("bomb.out", "w", stdout);
    char c;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i ++){
        c = getchar();
        for(int j = 1; j <= m; j ++){
            a[i][j] = dp[i][j] = getchar() - '0';
            dp[i][j] += dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
        }
    }
    t = m;
    ///for(int i = 1; i <= m; i ++)t[i] = m;
    for(int i = 1; i <= n; i ++){
        int L = 1, R = t, M;
        while(L <= R){
            M = (L + R) >> 1;
            if(check(i, M)){
                if(i * M > res) res = i * M;
                L = M + 1;
            }else
            R = M - 1;
        }
        t = R;
    }
    printf("%d", res);
    return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:27:10: warning: variable 'c' set but not used [-Wunused-but-set-variable]
     char c;
          ^
bomb.cpp:25:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("bomb.in", "r", stdin);
                                   ^
bomb.cpp:26:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen("bomb.out", "w", stdout);
                                     ^
bomb.cpp:28:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
                          ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
3 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
4 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
5 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
6 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
7 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
8 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
9 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
10 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
11 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
12 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
13 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
14 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
15 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
16 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
17 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
18 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
19 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
20 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
21 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
22 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
23 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
24 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
25 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
26 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
27 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
28 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
29 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
30 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
31 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
32 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
33 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
34 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
35 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
36 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
37 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
38 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
39 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
40 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
41 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
42 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
43 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
44 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
45 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
46 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
47 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
48 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
49 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
50 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
51 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
52 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
53 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
54 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
55 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
56 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
57 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
58 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
59 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
60 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
61 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
62 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
63 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
64 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
65 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
66 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
67 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
68 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
69 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
70 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
71 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
72 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
73 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
74 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
75 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
76 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
77 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
78 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
79 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
80 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
81 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
82 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
83 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
84 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
85 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
86 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
87 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
88 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
89 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
90 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
91 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
92 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
93 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
94 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
95 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
96 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
97 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
98 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
99 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
100 Runtime error 0 ms 49992 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)