제출 #38420

#제출 시각아이디문제언어결과실행 시간메모리
38420daniel_02Bomb (IZhO17_bomb)C++14
10 / 100
396 ms8612 KiB
#include <bits/stdc++.h>



using namespace std;

char a[2599][2599];

int ans;
int mx = 1e9, mx1 = 1e9;
int main()
{
   int n, m;
   cin >> n >> m;
   for (int i = 0; i < n; i++)
   {
       scanf("\n");
       for (int j = 0; j < m; j++)
       {
           scanf("%c",&a[i][j]);
       }
   }
   if (n > 1 && m > 1)
   {
       for (int i = 0; i < n; i++)
       {
           for (int j = 0; j < m; j++)
           {
               if (a[i][j] == '0')
               {
                   if (ans)
                        mx = min(mx, ans);
                   ans = 0;
               }
               else
               {
                   ans++;
               }
           }
       }
     
       cout << mx;
       return 0;
   }

   for (int i = 0; i < max(n, m); i++)
   {
       int j = min(n, m) - 1;
       if (j == n - 1)
       {
           if (a[j][i] == '1')
           {
               ans++;
           }
           else if (ans)
            mx = min(mx, ans),ans = 0;
       }
       else
       {
           if (a[i][j] == '1')
           {
               ans++;
           }
           else if (ans)
            mx = min(mx, ans),ans = 0;
       }
   }
   if (ans)
   mx = min(mx, ans);
   cout << mx;
}


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

bomb.cpp: In function 'int main()':
bomb.cpp:17:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
        scanf("\n");
                   ^
bomb.cpp:20:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
            scanf("%c",&a[i][j]);
                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...