제출 #1102844

#제출 시각아이디문제언어결과실행 시간메모리
1102844KasymKBomb (IZhO17_bomb)C++17
1 / 100
252 ms18640 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...