Submission #528497

# Submission time Handle Problem Language Result Execution time Memory
528497 2022-02-20T11:50:01 Z MilosMilutinovic Bomb (IZhO17_bomb) C++14
24 / 100
99 ms 31044 KB
#include <bits/stdc++.h> 
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;

int n, m, a[2505][2505];

int main()
{
  scanf("%d%d", &n, &m);
  rep1(i, n) {
    char s[m + 1];
    scanf("%s", s + 1);
    rep1(j, m) a[i][j] = s[j] - '0';
  }
  int ansx = 1e9, ansy = 1e9;
  rep1(i, n) rep1(j, m) {
    if(a[i][j] == 0) continue;
    int ptr = j;
    while(ptr < m && a[i][ptr + 1] == 1) ptr ++;
    ansx = min(ansx, ptr - j + 1);
    j = ptr;
  }
  rep1(j, m) rep1(i, n) {
    if(a[i][j] == 0) continue;
    int ptr = i;
    while(ptr < n && a[ptr + 1][j] == 1) ptr ++;
    ansy = min(ansy, ptr - i + 1);
    i = ptr;
  }
  printf("%d", ansx * ansy);
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d", &n, &m);
      |   ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     scanf("%s", s + 1);
      |     ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Correct 4 ms 10276 KB Output is correct
4 Correct 4 ms 10316 KB Output is correct
5 Correct 0 ms 300 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Incorrect 1 ms 296 KB Output isn't correct
9 Incorrect 0 ms 332 KB Output isn't correct
10 Incorrect 1 ms 332 KB Output isn't correct
11 Incorrect 0 ms 332 KB Output isn't correct
12 Incorrect 1 ms 332 KB Output isn't correct
13 Correct 0 ms 300 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Incorrect 1 ms 300 KB Output isn't correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Incorrect 1 ms 560 KB Output isn't correct
19 Incorrect 1 ms 716 KB Output isn't correct
20 Incorrect 1 ms 716 KB Output isn't correct
21 Incorrect 1 ms 464 KB Output isn't correct
22 Incorrect 1 ms 588 KB Output isn't correct
23 Incorrect 1 ms 716 KB Output isn't correct
24 Incorrect 1 ms 588 KB Output isn't correct
25 Incorrect 1 ms 688 KB Output isn't correct
26 Correct 1 ms 716 KB Output is correct
27 Correct 2 ms 1836 KB Output is correct
28 Incorrect 2 ms 1972 KB Output isn't correct
29 Incorrect 2 ms 2428 KB Output isn't correct
30 Incorrect 3 ms 2892 KB Output isn't correct
31 Incorrect 2 ms 2372 KB Output isn't correct
32 Incorrect 2 ms 2636 KB Output isn't correct
33 Incorrect 3 ms 2984 KB Output isn't correct
34 Incorrect 2 ms 2124 KB Output isn't correct
35 Incorrect 3 ms 3020 KB Output isn't correct
36 Correct 3 ms 3020 KB Output is correct
37 Incorrect 1 ms 332 KB Output isn't correct
38 Correct 82 ms 30904 KB Output is correct
39 Incorrect 0 ms 332 KB Output isn't correct
40 Incorrect 8 ms 7476 KB Output isn't correct
41 Incorrect 1 ms 332 KB Output isn't correct
42 Incorrect 1 ms 692 KB Output isn't correct
43 Correct 83 ms 30980 KB Output is correct
44 Incorrect 3 ms 2976 KB Output isn't correct
45 Incorrect 82 ms 30912 KB Output isn't correct
46 Correct 82 ms 31040 KB Output is correct
47 Incorrect 97 ms 30912 KB Output isn't correct
48 Incorrect 85 ms 30912 KB Output isn't correct
49 Correct 81 ms 30792 KB Output is correct
50 Incorrect 98 ms 30852 KB Output isn't correct
51 Incorrect 84 ms 30896 KB Output isn't correct
52 Incorrect 79 ms 30804 KB Output isn't correct
53 Incorrect 77 ms 30912 KB Output isn't correct
54 Incorrect 85 ms 31020 KB Output isn't correct
55 Incorrect 79 ms 30908 KB Output isn't correct
56 Correct 65 ms 30904 KB Output is correct
57 Incorrect 82 ms 30804 KB Output isn't correct
58 Incorrect 84 ms 30912 KB Output isn't correct
59 Incorrect 83 ms 30800 KB Output isn't correct
60 Correct 83 ms 30832 KB Output is correct
61 Correct 80 ms 30908 KB Output is correct
62 Correct 81 ms 30912 KB Output is correct
63 Correct 82 ms 30896 KB Output is correct
64 Correct 81 ms 31044 KB Output is correct
65 Incorrect 81 ms 30916 KB Output isn't correct
66 Incorrect 99 ms 30912 KB Output isn't correct
67 Incorrect 87 ms 30916 KB Output isn't correct
68 Incorrect 87 ms 30916 KB Output isn't correct
69 Incorrect 91 ms 30912 KB Output isn't correct
70 Incorrect 60 ms 23756 KB Output isn't correct
71 Incorrect 84 ms 30916 KB Output isn't correct
72 Incorrect 87 ms 30916 KB Output isn't correct
73 Incorrect 86 ms 30916 KB Output isn't correct
74 Incorrect 89 ms 30916 KB Output isn't correct
75 Incorrect 97 ms 31024 KB Output isn't correct
76 Incorrect 92 ms 30920 KB Output isn't correct
77 Incorrect 92 ms 30848 KB Output isn't correct
78 Incorrect 92 ms 30812 KB Output isn't correct
79 Incorrect 96 ms 30860 KB Output isn't correct
80 Incorrect 89 ms 30796 KB Output isn't correct
81 Incorrect 89 ms 30852 KB Output isn't correct
82 Incorrect 92 ms 30912 KB Output isn't correct
83 Incorrect 90 ms 30800 KB Output isn't correct
84 Incorrect 88 ms 30812 KB Output isn't correct
85 Incorrect 82 ms 30916 KB Output isn't correct
86 Incorrect 92 ms 30820 KB Output isn't correct
87 Incorrect 93 ms 31012 KB Output isn't correct
88 Incorrect 95 ms 30800 KB Output isn't correct
89 Incorrect 93 ms 31032 KB Output isn't correct
90 Incorrect 61 ms 23760 KB Output isn't correct
91 Incorrect 93 ms 30920 KB Output isn't correct
92 Incorrect 91 ms 30924 KB Output isn't correct
93 Incorrect 89 ms 30836 KB Output isn't correct
94 Incorrect 98 ms 30912 KB Output isn't correct
95 Incorrect 89 ms 30796 KB Output isn't correct
96 Incorrect 90 ms 30916 KB Output isn't correct
97 Incorrect 92 ms 30964 KB Output isn't correct
98 Incorrect 87 ms 30920 KB Output isn't correct
99 Incorrect 89 ms 30916 KB Output isn't correct
100 Incorrect 88 ms 30812 KB Output isn't correct