Submission #216596

# Submission time Handle Problem Language Result Execution time Memory
216596 2020-03-27T15:28:48 Z quocnguyen1012 Bomb (IZhO17_bomb) C++14
24 / 100
151 ms 12796 KB
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 2505;

char s[maxn][maxn];
int N, M;

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL

  cin >> N >> M;
  int h = N, w = M;
  for(int i = 1; i <= N; ++i){
    for(int j = 1; j <= M; ++j){
      cin >> s[i][j];
      s[i][j] -= '0';
    }
  }
  for(int r = 1; r <= N; ++r){
    for(int c = 1; c <= M; ++c){
      if(s[r][c] == 0) continue;
      int j = c;
      while(s[r][j] == 1) ++j; --j;
      w = min(w, j - c + 1);
      c = j;
    }
  }
  for(int c = 1; c <= M; ++c){
    for(int r = 1; r <= N; ++r){
      if(s[r][c] == 0) continue;
      int j = r;
      while(s[j][c] == 1) ++j; --j;
      h = min(h, j - r + 1);
      r = j;
    }
  }
  cout << h * w;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:38:7: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
       while(s[r][j] == 1) ++j; --j;
       ^~~~~
bomb.cpp:38:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
       while(s[r][j] == 1) ++j; --j;
                                ^~
bomb.cpp:47:7: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
       while(s[j][c] == 1) ++j; --j;
       ^~~~~
bomb.cpp:47:32: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
       while(s[j][c] == 1) ++j; --j;
                                ^~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 6528 KB Output is correct
4 Correct 9 ms 6528 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Incorrect 5 ms 384 KB Output isn't correct
9 Incorrect 5 ms 384 KB Output isn't correct
10 Incorrect 5 ms 384 KB Output isn't correct
11 Incorrect 5 ms 384 KB Output isn't correct
12 Incorrect 4 ms 384 KB Output isn't correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Incorrect 5 ms 384 KB Output isn't correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Incorrect 5 ms 512 KB Output isn't correct
19 Incorrect 5 ms 640 KB Output isn't correct
20 Incorrect 5 ms 640 KB Output isn't correct
21 Incorrect 5 ms 512 KB Output isn't correct
22 Incorrect 5 ms 512 KB Output isn't correct
23 Incorrect 5 ms 640 KB Output isn't correct
24 Incorrect 5 ms 512 KB Output isn't correct
25 Incorrect 5 ms 640 KB Output isn't correct
26 Correct 5 ms 640 KB Output is correct
27 Correct 7 ms 1152 KB Output is correct
28 Incorrect 7 ms 1152 KB Output isn't correct
29 Incorrect 7 ms 1408 KB Output isn't correct
30 Incorrect 8 ms 1664 KB Output isn't correct
31 Incorrect 9 ms 1280 KB Output isn't correct
32 Incorrect 10 ms 1536 KB Output isn't correct
33 Incorrect 8 ms 1664 KB Output isn't correct
34 Incorrect 7 ms 1280 KB Output isn't correct
35 Incorrect 8 ms 1664 KB Output isn't correct
36 Correct 10 ms 1664 KB Output is correct
37 Incorrect 5 ms 384 KB Output isn't correct
38 Correct 123 ms 12536 KB Output is correct
39 Incorrect 5 ms 384 KB Output isn't correct
40 Incorrect 18 ms 3328 KB Output isn't correct
41 Incorrect 5 ms 384 KB Output isn't correct
42 Incorrect 5 ms 640 KB Output isn't correct
43 Correct 121 ms 12536 KB Output is correct
44 Incorrect 8 ms 1664 KB Output isn't correct
45 Incorrect 127 ms 12536 KB Output isn't correct
46 Correct 136 ms 12664 KB Output is correct
47 Incorrect 126 ms 12664 KB Output isn't correct
48 Incorrect 127 ms 12536 KB Output isn't correct
49 Correct 120 ms 12536 KB Output is correct
50 Incorrect 127 ms 12672 KB Output isn't correct
51 Incorrect 123 ms 12644 KB Output isn't correct
52 Incorrect 123 ms 12664 KB Output isn't correct
53 Incorrect 126 ms 12596 KB Output isn't correct
54 Incorrect 136 ms 12732 KB Output isn't correct
55 Incorrect 124 ms 12536 KB Output isn't correct
56 Correct 120 ms 12664 KB Output is correct
57 Incorrect 120 ms 12664 KB Output isn't correct
58 Incorrect 131 ms 12784 KB Output isn't correct
59 Incorrect 123 ms 12664 KB Output isn't correct
60 Correct 130 ms 12536 KB Output is correct
61 Correct 128 ms 12536 KB Output is correct
62 Correct 119 ms 12664 KB Output is correct
63 Correct 123 ms 12664 KB Output is correct
64 Correct 138 ms 12536 KB Output is correct
65 Incorrect 126 ms 12540 KB Output isn't correct
66 Incorrect 149 ms 12596 KB Output isn't correct
67 Incorrect 130 ms 12664 KB Output isn't correct
68 Incorrect 125 ms 12620 KB Output isn't correct
69 Incorrect 136 ms 12640 KB Output isn't correct
70 Incorrect 67 ms 9260 KB Output isn't correct
71 Incorrect 151 ms 12712 KB Output isn't correct
72 Incorrect 128 ms 12536 KB Output isn't correct
73 Incorrect 125 ms 12664 KB Output isn't correct
74 Incorrect 124 ms 12664 KB Output isn't correct
75 Incorrect 130 ms 12664 KB Output isn't correct
76 Incorrect 130 ms 12536 KB Output isn't correct
77 Incorrect 123 ms 12536 KB Output isn't correct
78 Incorrect 130 ms 12664 KB Output isn't correct
79 Incorrect 132 ms 12664 KB Output isn't correct
80 Incorrect 130 ms 12536 KB Output isn't correct
81 Incorrect 132 ms 12536 KB Output isn't correct
82 Incorrect 124 ms 12536 KB Output isn't correct
83 Incorrect 140 ms 12740 KB Output isn't correct
84 Incorrect 126 ms 12536 KB Output isn't correct
85 Incorrect 131 ms 12552 KB Output isn't correct
86 Incorrect 133 ms 12536 KB Output isn't correct
87 Incorrect 135 ms 12536 KB Output isn't correct
88 Incorrect 127 ms 12536 KB Output isn't correct
89 Incorrect 132 ms 12540 KB Output isn't correct
90 Incorrect 67 ms 9208 KB Output isn't correct
91 Incorrect 127 ms 12736 KB Output isn't correct
92 Incorrect 133 ms 12664 KB Output isn't correct
93 Incorrect 128 ms 12640 KB Output isn't correct
94 Incorrect 129 ms 12536 KB Output isn't correct
95 Incorrect 134 ms 12796 KB Output isn't correct
96 Incorrect 137 ms 12536 KB Output isn't correct
97 Incorrect 126 ms 12664 KB Output isn't correct
98 Incorrect 127 ms 12536 KB Output isn't correct
99 Incorrect 138 ms 12668 KB Output isn't correct
100 Incorrect 127 ms 12664 KB Output isn't correct