# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38383 | Just_Solve_The_Problem | Bomb (IZhO17_bomb) | C++11 | 143 ms | 8144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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);
bool fl = 1;
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;
if (ss == '1') fl = 0;
}
}
}
if (fl) {
puts("0");
return 0;
}
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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |