Submission #388275

#TimeUsernameProblemLanguageResultExecution timeMemory
388275patrikpavic2Bomb (IZhO17_bomb)C++17
15 / 100
1097 ms12640 KiB
#include <cstdio> #include <algorithm> using namespace std; const int N = 2505; int n, m; char s[N][N]; int main(){ //freopen("bomb.in", "r", stdin); //freopen("bomb.out", "w", stdout); scanf("%d%d", &n, &m); for(int i = 0;i < n;i++) for(int j = 0;j < m;j++) scanf(" %c", &s[i][j]); int ansi = n, ansj = m; for(int i = 0;i < n;i++){ for(int j = 0;j < m;j++){ if(s[i][j] != '1') continue; int il = i, ir = i; int jl = j, jr = j; while(il > 0 && s[il - 1][j] == '1') il--; while(ir + 1 < n && s[ir + 1][j] == '1') ir++; while(jl > 0 && s[i][jl - 1] == '1') jl--; while(jr + 1 < m && s[i][jr + 1] == '1') jr++; ansi = min(ansi, ir - il + 1); ansj = min(ansj, jr - jl + 1); } } printf("%d\n", ansi * ansj); return 0; }

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
bomb.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |    scanf(" %c", &s[i][j]);
      |    ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...