# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1046836 | wenqi | Bomb (IZhO17_bomb) | C++17 | 63 ms | 31080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()
int N, M, grid[2505][2505];
int main(int, const char **) {
cin.tie(NULL)->sync_with_stdio(false);
cin >> N >> M;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= M; j++) {
char x;
cin >> x;
grid[i][j] = x - '0';
}
}
int a = 1e9, b = 1e9;
for (int i = 1; i <= N; i++) {
int cnt = 0;
for (int j = 1; j <= M; j++) {
if (grid[i][j]) {
cnt++;
} else if (cnt) {
a = min(a, cnt);
cnt = 0;
}
}
if (cnt) a = min(a, cnt);
}
for (int j = 1; j <= M; j++) {
int cnt = 0;
for (int i = 1; i <= N; i++) {
if (grid[i][j]) {
cnt++;
} else if (cnt) {
b = min(b, cnt);
cnt = 0;
}
}
if (cnt) b = min(b, cnt);
}
cout << (ll)a * b;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |