답안 #833188

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833188 2023-08-22T03:01:55 Z vjudge1 Bomb (IZhO17_bomb) C++17
29 / 100
1000 ms 61756 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
typedef long long ll;
const ll MAXN = 25e2 + 5;
const ll INF = 1e9;
#define endl '\n'
#define pll pair <ll, ll>
#define fi first
#define se second

ll n, m;
string a [MAXN];
ll pf [MAXN][MAXN];
bool uda [MAXN][MAXN];

int main(){
    cin >> n >> m;
    for(ll i = 1; i <= n; i++){
        string dum; cin >> dum;
        a[i] = '2' + dum;
    }
    if(n == 1 && m == 1){
        cout << a[1][1] << endl;
        exit(0);
    }
    for(ll i = 1; i <= n; i++){
        for(ll j = 1; j <= m; j++){
            pf[i][j] = pf[i][j-1];
            if(a[i][j] == '1') pf[i][j]++;
        }
    }
    for(ll j = 1; j <= m; j++){
        for(ll i = 1; i <= n; i++){
            pf[i][j] += pf[i-1][j];
        }
    }
    // cout << endl;
    // for(ll i = 1; i <= n; i++){
    //     for(ll j = 1; j <= m; j++){
    //         cout << pf[i][j] << " ";
    //     }
    //     cout << endl;
    // }
    // cout << endl;
    ll mx = 0;
    for(ll x = 1; x <= n; x++){
        for(ll y = 1; y <= m; y++){
            for(ll i = 1; i <= n; i++){
                for(ll j = 1; j <= m; j++) uda[i][j] = false;
            }
            for(ll i = 1; i+x-1 <= n; i++){
                for(ll j = 1; j+y-1 <= m; j++){
                    ll sum = pf[i+x-1][j+y-1] - pf[i-1][j+y-1] - pf[i+x-1][j-1] + pf[i-1][j-1];
                    if(sum == x*y){
                        for(ll lx = i; lx <= i+x-1; lx++){
                            for(ll ly = j; ly <= j+y-1; ly++){
                                uda[lx][ly] = true;
                            }
                        }
                    }
                }
            }
            bool bnr = true;
            for(ll i = 1; i <= n; i++){
                for(ll j = 1; j <= m; j++){
                    if(!uda[i][j] && a[i][j] == '1'){
                        bnr = false;
                        break;
                    }
                }
            }
            if(bnr){
                mx = max(mx, x*y);
            }
        }
    }
    cout << mx << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 468 KB Output is correct
3 Execution timed out 1079 ms 16548 KB Time limit exceeded
4 Correct 828 ms 16576 KB Output is correct
5 Correct 6 ms 340 KB Output is correct
6 Correct 3 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 1 ms 468 KB Output is correct
15 Correct 1 ms 468 KB Output is correct
16 Correct 1 ms 468 KB Output is correct
17 Correct 10 ms 852 KB Output is correct
18 Correct 13 ms 852 KB Output is correct
19 Correct 36 ms 1100 KB Output is correct
20 Correct 40 ms 980 KB Output is correct
21 Correct 16 ms 776 KB Output is correct
22 Correct 39 ms 944 KB Output is correct
23 Correct 76 ms 1112 KB Output is correct
24 Correct 31 ms 952 KB Output is correct
25 Correct 96 ms 1112 KB Output is correct
26 Correct 936 ms 1108 KB Output is correct
27 Execution timed out 1077 ms 2900 KB Time limit exceeded
28 Execution timed out 1076 ms 3156 KB Time limit exceeded
29 Execution timed out 1084 ms 3924 KB Time limit exceeded
30 Execution timed out 1089 ms 4820 KB Time limit exceeded
31 Execution timed out 1088 ms 3796 KB Time limit exceeded
32 Execution timed out 1078 ms 4308 KB Time limit exceeded
33 Execution timed out 1074 ms 5076 KB Time limit exceeded
34 Execution timed out 1078 ms 3412 KB Time limit exceeded
35 Execution timed out 1075 ms 5076 KB Time limit exceeded
36 Execution timed out 1082 ms 5076 KB Time limit exceeded
37 Correct 1 ms 468 KB Output is correct
38 Execution timed out 1080 ms 61596 KB Time limit exceeded
39 Correct 1 ms 468 KB Output is correct
40 Execution timed out 1082 ms 12740 KB Time limit exceeded
41 Correct 1 ms 468 KB Output is correct
42 Correct 383 ms 1112 KB Output is correct
43 Execution timed out 1085 ms 61648 KB Time limit exceeded
44 Execution timed out 1080 ms 5044 KB Time limit exceeded
45 Execution timed out 1085 ms 61580 KB Time limit exceeded
46 Execution timed out 1087 ms 61596 KB Time limit exceeded
47 Execution timed out 1092 ms 61632 KB Time limit exceeded
48 Execution timed out 1071 ms 61632 KB Time limit exceeded
49 Execution timed out 1085 ms 61556 KB Time limit exceeded
50 Execution timed out 1083 ms 61616 KB Time limit exceeded
51 Execution timed out 1080 ms 61624 KB Time limit exceeded
52 Execution timed out 1083 ms 61644 KB Time limit exceeded
53 Execution timed out 1088 ms 61632 KB Time limit exceeded
54 Execution timed out 1091 ms 61556 KB Time limit exceeded
55 Execution timed out 1086 ms 61556 KB Time limit exceeded
56 Execution timed out 1081 ms 61640 KB Time limit exceeded
57 Execution timed out 1087 ms 61652 KB Time limit exceeded
58 Execution timed out 1091 ms 61620 KB Time limit exceeded
59 Execution timed out 1082 ms 61640 KB Time limit exceeded
60 Execution timed out 1091 ms 61656 KB Time limit exceeded
61 Execution timed out 1088 ms 61592 KB Time limit exceeded
62 Execution timed out 1078 ms 61536 KB Time limit exceeded
63 Execution timed out 1082 ms 61588 KB Time limit exceeded
64 Execution timed out 1075 ms 61600 KB Time limit exceeded
65 Execution timed out 1085 ms 61580 KB Time limit exceeded
66 Execution timed out 1077 ms 61632 KB Time limit exceeded
67 Execution timed out 1083 ms 61580 KB Time limit exceeded
68 Execution timed out 1073 ms 61660 KB Time limit exceeded
69 Execution timed out 1082 ms 61608 KB Time limit exceeded
70 Execution timed out 1082 ms 48404 KB Time limit exceeded
71 Execution timed out 1082 ms 61552 KB Time limit exceeded
72 Execution timed out 1086 ms 61644 KB Time limit exceeded
73 Execution timed out 1075 ms 61540 KB Time limit exceeded
74 Execution timed out 1078 ms 61632 KB Time limit exceeded
75 Execution timed out 1074 ms 61576 KB Time limit exceeded
76 Execution timed out 1085 ms 61644 KB Time limit exceeded
77 Execution timed out 1076 ms 61556 KB Time limit exceeded
78 Execution timed out 1081 ms 61612 KB Time limit exceeded
79 Execution timed out 1080 ms 61632 KB Time limit exceeded
80 Execution timed out 1060 ms 61756 KB Time limit exceeded
81 Execution timed out 1084 ms 61612 KB Time limit exceeded
82 Execution timed out 1086 ms 61584 KB Time limit exceeded
83 Execution timed out 1078 ms 61556 KB Time limit exceeded
84 Execution timed out 1069 ms 61604 KB Time limit exceeded
85 Execution timed out 1077 ms 61616 KB Time limit exceeded
86 Execution timed out 1076 ms 61556 KB Time limit exceeded
87 Execution timed out 1085 ms 61596 KB Time limit exceeded
88 Execution timed out 1078 ms 61600 KB Time limit exceeded
89 Execution timed out 1083 ms 61584 KB Time limit exceeded
90 Execution timed out 1084 ms 48320 KB Time limit exceeded
91 Execution timed out 1085 ms 61532 KB Time limit exceeded
92 Execution timed out 1086 ms 61624 KB Time limit exceeded
93 Execution timed out 1071 ms 61680 KB Time limit exceeded
94 Execution timed out 1079 ms 61608 KB Time limit exceeded
95 Execution timed out 1081 ms 61588 KB Time limit exceeded
96 Execution timed out 1094 ms 61676 KB Time limit exceeded
97 Execution timed out 1083 ms 61684 KB Time limit exceeded
98 Execution timed out 1084 ms 61648 KB Time limit exceeded
99 Execution timed out 1076 ms 61644 KB Time limit exceeded
100 Execution timed out 1077 ms 61560 KB Time limit exceeded