Submission #1102844

# Submission time Handle Problem Language Result Execution time Memory
1102844 2024-10-19T04:53:30 Z KasymK Bomb (IZhO17_bomb) C++17
1 / 100
252 ms 18640 KB
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pli pair<ll, int>
#define pll pair<ll, ll>
#define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i)
#define wr puts("----------------")
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int N = 2505;
char v[N][N];

int main(){
    int n, m;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; ++i)
        for(int j = 1; j <= m; ++j){
            char c;
            scanf(" %c", &c);
            v[i][j] = c;
        }
    if(n==1){
        int mx = 1e9, j1;
        for(int j = 1; j <= m; ++j){
            j1 = j;
            if(v[1][j])
                for(int k = j+1; k <= m and v[1][k]; ++k)
                    j1 = k;
            if(j1 != j)    
                umin(mx, j1-j+1);
        }
        printf("%d\n", mx);
        return 0;
    }
    assert(m==1);
    int mx = 1e9, i1;
    for(int i = 1; i <= n; ++i){
        i1 = i;
        if(v[i][1])
            for(int k = i+1; k <= n and v[k][1]; ++k)
                i1 = k;
        if(i1 != i)
            umin(mx, i1-i+1);
    }
    printf("%d\n", mx);
    return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:24:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |             scanf(" %c", &c);
      |             ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB Output isn't correct
2 Correct 1 ms 336 KB Output is correct
3 Incorrect 4 ms 6480 KB Output isn't correct
4 Incorrect 4 ms 6480 KB Output isn't correct
5 Incorrect 2 ms 336 KB Output isn't correct
6 Incorrect 1 ms 336 KB Output isn't correct
7 Runtime error 1 ms 592 KB Execution killed with signal 6
8 Runtime error 1 ms 592 KB Execution killed with signal 6
9 Runtime error 1 ms 592 KB Execution killed with signal 6
10 Runtime error 2 ms 592 KB Execution killed with signal 6
11 Runtime error 1 ms 592 KB Execution killed with signal 6
12 Runtime error 1 ms 592 KB Execution killed with signal 6
13 Runtime error 2 ms 592 KB Execution killed with signal 6
14 Runtime error 1 ms 592 KB Execution killed with signal 6
15 Runtime error 1 ms 592 KB Execution killed with signal 6
16 Runtime error 2 ms 760 KB Execution killed with signal 6
17 Runtime error 2 ms 884 KB Execution killed with signal 6
18 Runtime error 2 ms 848 KB Execution killed with signal 6
19 Runtime error 5 ms 4944 KB Execution killed with signal 6
20 Runtime error 5 ms 4944 KB Execution killed with signal 6
21 Runtime error 2 ms 848 KB Execution killed with signal 6
22 Runtime error 4 ms 4944 KB Execution killed with signal 6
23 Runtime error 5 ms 4944 KB Execution killed with signal 6
24 Runtime error 5 ms 4944 KB Execution killed with signal 6
25 Runtime error 4 ms 5128 KB Execution killed with signal 6
26 Runtime error 5 ms 4944 KB Execution killed with signal 6
27 Runtime error 8 ms 5200 KB Execution killed with signal 6
28 Runtime error 9 ms 5212 KB Execution killed with signal 6
29 Runtime error 9 ms 5040 KB Execution killed with signal 6
30 Runtime error 13 ms 4956 KB Execution killed with signal 6
31 Runtime error 9 ms 5212 KB Execution killed with signal 6
32 Runtime error 9 ms 5016 KB Execution killed with signal 6
33 Runtime error 14 ms 4956 KB Execution killed with signal 6
34 Runtime error 8 ms 4956 KB Execution killed with signal 6
35 Runtime error 10 ms 4956 KB Execution killed with signal 6
36 Runtime error 11 ms 5280 KB Execution killed with signal 6
37 Runtime error 2 ms 604 KB Execution killed with signal 6
38 Runtime error 204 ms 18408 KB Execution killed with signal 6
39 Runtime error 2 ms 608 KB Execution killed with signal 6
40 Runtime error 29 ms 4988 KB Execution killed with signal 6
41 Runtime error 1 ms 604 KB Execution killed with signal 6
42 Runtime error 5 ms 5076 KB Execution killed with signal 6
43 Runtime error 199 ms 12920 KB Execution killed with signal 6
44 Runtime error 11 ms 5200 KB Execution killed with signal 6
45 Runtime error 199 ms 16200 KB Execution killed with signal 6
46 Runtime error 196 ms 17736 KB Execution killed with signal 6
47 Runtime error 213 ms 12904 KB Execution killed with signal 6
48 Runtime error 197 ms 18504 KB Execution killed with signal 6
49 Runtime error 208 ms 16200 KB Execution killed with signal 6
50 Runtime error 197 ms 17736 KB Execution killed with signal 6
51 Runtime error 203 ms 16324 KB Execution killed with signal 6
52 Runtime error 194 ms 12872 KB Execution killed with signal 6
53 Runtime error 198 ms 12920 KB Execution killed with signal 6
54 Runtime error 211 ms 17636 KB Execution killed with signal 6
55 Runtime error 188 ms 18516 KB Execution killed with signal 6
56 Runtime error 184 ms 12920 KB Execution killed with signal 6
57 Runtime error 193 ms 16236 KB Execution killed with signal 6
58 Runtime error 189 ms 18640 KB Execution killed with signal 6
59 Runtime error 187 ms 17740 KB Execution killed with signal 6
60 Runtime error 183 ms 12888 KB Execution killed with signal 6
61 Runtime error 191 ms 12920 KB Execution killed with signal 6
62 Runtime error 187 ms 12876 KB Execution killed with signal 6
63 Runtime error 187 ms 16200 KB Execution killed with signal 6
64 Runtime error 184 ms 12872 KB Execution killed with signal 6
65 Runtime error 192 ms 12872 KB Execution killed with signal 6
66 Runtime error 184 ms 12872 KB Execution killed with signal 6
67 Runtime error 185 ms 18516 KB Execution killed with signal 6
68 Runtime error 185 ms 17748 KB Execution killed with signal 6
69 Runtime error 207 ms 12872 KB Execution killed with signal 6
70 Runtime error 134 ms 10352 KB Execution killed with signal 6
71 Runtime error 198 ms 12904 KB Execution killed with signal 6
72 Runtime error 210 ms 12908 KB Execution killed with signal 6
73 Runtime error 201 ms 18396 KB Execution killed with signal 6
74 Runtime error 189 ms 12872 KB Execution killed with signal 6
75 Runtime error 235 ms 17736 KB Execution killed with signal 6
76 Runtime error 209 ms 12872 KB Execution killed with signal 6
77 Runtime error 198 ms 16240 KB Execution killed with signal 6
78 Runtime error 198 ms 12876 KB Execution killed with signal 6
79 Runtime error 213 ms 16456 KB Execution killed with signal 6
80 Runtime error 190 ms 16208 KB Execution killed with signal 6
81 Runtime error 191 ms 12872 KB Execution killed with signal 6
82 Runtime error 196 ms 16208 KB Execution killed with signal 6
83 Runtime error 217 ms 17692 KB Execution killed with signal 6
84 Runtime error 192 ms 17628 KB Execution killed with signal 6
85 Runtime error 204 ms 12888 KB Execution killed with signal 6
86 Runtime error 252 ms 16348 KB Execution killed with signal 6
87 Runtime error 197 ms 12872 KB Execution killed with signal 6
88 Runtime error 188 ms 16212 KB Execution killed with signal 6
89 Runtime error 198 ms 12872 KB Execution killed with signal 6
90 Runtime error 122 ms 14152 KB Execution killed with signal 6
91 Runtime error 184 ms 12900 KB Execution killed with signal 6
92 Runtime error 198 ms 12888 KB Execution killed with signal 6
93 Runtime error 220 ms 12916 KB Execution killed with signal 6
94 Runtime error 208 ms 16280 KB Execution killed with signal 6
95 Runtime error 200 ms 17644 KB Execution killed with signal 6
96 Runtime error 196 ms 12920 KB Execution killed with signal 6
97 Runtime error 214 ms 16200 KB Execution killed with signal 6
98 Runtime error 197 ms 12792 KB Execution killed with signal 6
99 Runtime error 198 ms 12924 KB Execution killed with signal 6
100 Runtime error 209 ms 12916 KB Execution killed with signal 6