# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38395 | 2018-01-04T05:06:03 Z | Talant | Bomb (IZhO17_bomb) | C++14 | 1000 ms | 131072 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define OK puts("OK"); #define pb push_back #define mk make_pair using namespace std; typedef long long ll; const int inf = (int)1e9 + 7; const int N = (int)1e6 + 10; int n,m; char a[2501][2501]; int t[2501][2501]; int c[2501][2501]; int mx,mn = inf,mn1 = inf; vector <pair<int,int> > v; bool check (int h,int w) { for (int i = h; i <= n; i ++) { for (int j = w; j <= m; j ++) { if (c[i][j] - c[i - h][j] - c[i][j - w] + c[i - h][j - w] == (h * w)) { for (int l = i - h + 1; l <= i; l ++) { for (int r = j - w + 1; r <= j; r ++) { t[l][r] = -1; } } j += w; } } } int f = 0; for (int i = 0; i < v.size(); i ++) { if (t[v[i].fr][v[i].sc] == 1) f - 1; t[v[i].fr][v[i].sc] = 1; } if (f) return false; return true; } int main () { cin >> n >> m; for (int i = 1; i <= n; i ++) scanf ("%s", a[i] + 1); for (int i = 1; i <= n; i ++) { int cnt = 0; for (int j = 1; j <= m; j ++) { t[i][j] = int(a[i][j] - '0'); c[i][j] = t[i][j]; if (t[i][j] == 1) v.pb(mk(i,j)); if (c[i][j] == 1) cnt ++; else { if (cnt > 0) mn = min(mn,cnt); cnt = 0; } } if (cnt > 0) mn = min(mn,cnt); } for (int i = 1; i <= m; i ++) { int cnt = 0; for (int j = 1; j <= n; j ++) { if (c[j][i] == 1) cnt ++; else { if (cnt > 0) mn1 = min(mn1,cnt); cnt = 0; } } if (cnt > 0) mn1 = min(mn1,cnt); } if (mn == inf) mn = 0; if (mn1 == inf) mn1 = 0; for (int i = 1; i <= n; i ++) for (int j = 2; j <= m; j ++) c[i][j] += c[i][j - 1]; for (int i = 2; i <= n; i ++) for (int j = 1; j <= m; j ++) c[i][j] += c[i - 1][j]; for (int i = 1; i <= mn1; i ++) { for (int j = 1; j <= mn; j ++) { if (check(i,j)) mx = max(mx,i * j); } } cout << mx << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 56992 KB | Output is correct |
2 | Correct | 0 ms | 56992 KB | Output is correct |
3 | Correct | 9 ms | 57132 KB | Output is correct |
4 | Correct | 23 ms | 57132 KB | Output is correct |
5 | Correct | 0 ms | 57132 KB | Output is correct |
6 | Correct | 0 ms | 56992 KB | Output is correct |
7 | Correct | 0 ms | 56992 KB | Output is correct |
8 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
9 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
10 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
11 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
12 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
13 | Correct | 0 ms | 56992 KB | Output is correct |
14 | Correct | 0 ms | 56992 KB | Output is correct |
15 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
16 | Correct | 0 ms | 56992 KB | Output is correct |
17 | Correct | 0 ms | 56992 KB | Output is correct |
18 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
19 | Incorrect | 6 ms | 56992 KB | Output isn't correct |
20 | Incorrect | 6 ms | 56992 KB | Output isn't correct |
21 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
22 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
23 | Incorrect | 19 ms | 57132 KB | Output isn't correct |
24 | Incorrect | 3 ms | 56992 KB | Output isn't correct |
25 | Incorrect | 46 ms | 57132 KB | Output isn't correct |
26 | Correct | 13 ms | 57264 KB | Output is correct |
27 | Correct | 6 ms | 58612 KB | Output is correct |
28 | Incorrect | 19 ms | 56992 KB | Output isn't correct |
29 | Execution timed out | 1000 ms | 58612 KB | Execution timed out |
30 | Execution timed out | 1000 ms | 57844 KB | Execution timed out |
31 | Execution timed out | 1000 ms | 57460 KB | Execution timed out |
32 | Execution timed out | 1000 ms | 57460 KB | Execution timed out |
33 | Execution timed out | 1000 ms | 57844 KB | Execution timed out |
34 | Incorrect | 29 ms | 56992 KB | Output isn't correct |
35 | Execution timed out | 1000 ms | 57264 KB | Execution timed out |
36 | Execution timed out | 1000 ms | 60148 KB | Execution timed out |
37 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
38 | Memory limit exceeded | 76 ms | 131072 KB | Memory limit exceeded |
39 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
40 | Execution timed out | 1000 ms | 69364 KB | Execution timed out |
41 | Incorrect | 0 ms | 56992 KB | Output isn't correct |
42 | Incorrect | 236 ms | 57132 KB | Output isn't correct |
43 | Memory limit exceeded | 103 ms | 131072 KB | Memory limit exceeded |
44 | Execution timed out | 1000 ms | 58612 KB | Execution timed out |
45 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
46 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
47 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
48 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
49 | Memory limit exceeded | 76 ms | 131072 KB | Memory limit exceeded |
50 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
51 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
52 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
53 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
54 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
55 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
56 | Memory limit exceeded | 83 ms | 131072 KB | Memory limit exceeded |
57 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
58 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
59 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
60 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
61 | Memory limit exceeded | 93 ms | 131072 KB | Memory limit exceeded |
62 | Memory limit exceeded | 79 ms | 131072 KB | Memory limit exceeded |
63 | Memory limit exceeded | 83 ms | 131072 KB | Memory limit exceeded |
64 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
65 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
66 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
67 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
68 | Memory limit exceeded | 89 ms | 131072 KB | Memory limit exceeded |
69 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
70 | Execution timed out | 1000 ms | 63220 KB | Execution timed out |
71 | Execution timed out | 1000 ms | 69364 KB | Execution timed out |
72 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
73 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
74 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
75 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
76 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
77 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
78 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
79 | Execution timed out | 1000 ms | 57460 KB | Execution timed out |
80 | Execution timed out | 1000 ms | 57460 KB | Execution timed out |
81 | Execution timed out | 1000 ms | 60148 KB | Execution timed out |
82 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
83 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
84 | Execution timed out | 1000 ms | 57264 KB | Execution timed out |
85 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
86 | Memory limit exceeded | 93 ms | 131072 KB | Memory limit exceeded |
87 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
88 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
89 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
90 | Execution timed out | 1000 ms | 69364 KB | Execution timed out |
91 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
92 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
93 | Memory limit exceeded | 93 ms | 131072 KB | Memory limit exceeded |
94 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
95 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
96 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
97 | Memory limit exceeded | 103 ms | 131072 KB | Memory limit exceeded |
98 | Execution timed out | 1000 ms | 81652 KB | Execution timed out |
99 | Execution timed out | 1000 ms | 106228 KB | Execution timed out |
100 | Memory limit exceeded | 103 ms | 131072 KB | Memory limit exceeded |