Submission #91717

#TimeUsernameProblemLanguageResultExecution timeMemory
91717popovicirobertBomb (IZhO17_bomb)C++14
24 / 100
51 ms12764 KiB
#include <bits/stdc++.h> #define lsb(x) (x & (-x)) #define ll long long #define ull unsigned long long #define ld long double // 217 // 44 using namespace std; const int MAXN = 2505; char mat[MAXN + 1][MAXN + 1]; int main() { //ifstream cin("A.in"); //ofstream cout("A.out"); int i, j, n, m; ios::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin >> n >> m; int l = n, c = m; for(i = 1; i <= n; i++) { cin >> mat[i] + 1; for(j = 1; j <= m; j++) { mat[i][j] -= '0'; } int cur = 0; for(j = 1; j <= m; j++) { cur = (cur + 1) * mat[i][j]; if(mat[i][j] == 1 && mat[i][j + 1] == 0) { c = min(c, cur); } } } for(j = 1; j <= m; j++) { int cur = 0; for(i = 1; i <= n; i++) { cur = (cur + 1) * mat[i][j]; if(mat[i][j] && mat[i + 1][j] == 0) { l = min(l, cur); } } } cout << l * c; //cin.close(); //cout.close(); return 0; }

Compilation message (stderr)

bomb.cpp: In function 'int main()':
bomb.cpp:24:23: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         cin >> mat[i] + 1;
                ~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...