Submission #38391

#TimeUsernameProblemLanguageResultExecution timeMemory
38391Just_Solve_The_ProblemBomb (IZhO17_bomb)C++11
0 / 100
0 ms8144 KiB
#include <bits/stdc++.h> using namespace std; const int N = (int)2505; char c[N][N]; main () { #define NAME "bomb" freopen(NAME".in", "r", stdin); freopen(NAME".out", "w", stdout); int n, m; scanf ("%d %d", &n, &m); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { char ss; ss = getchar(); if (ss == '\n') j--; else c[i][j] = ss; } } int h = N; int w = N; for (int i = 1; i <= n; i++) { int res = 0; for (int j = 1; j <= m; j++) { if (c[i][j] == '0' && res != 0) { w = min(w, res); res = 0; } if (c[i][j] == '1') res++; } if (res != 0) w = min(w, res); } for (int i = 1; i <= m; i++) { int res = 0; for (int j = 1; j <= n; j++) { if (c[j][i] == '0' && res != 0) { h = min(h, res); res = 0; } if (c[j][i] == '1') res++; // cout << j << ' ' << i << ' ' << res << endl; } if (res != 0) h = min(h, res); } // cout << h << ' ' << w << endl; cout << h * w; }

Compilation message (stderr)

bomb.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
bomb.cpp: In function 'int main()':
bomb.cpp:11:35: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(NAME".in", "r", stdin);
                                   ^
bomb.cpp:12:37: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
     freopen(NAME".out", "w", stdout);
                                     ^
bomb.cpp:13:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int n, m; scanf ("%d %d", &n, &m);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...