# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
528497 | MilosMilutinovic | Bomb (IZhO17_bomb) | C++14 | 99 ms | 31044 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
int n, m, a[2505][2505];
int main()
{
scanf("%d%d", &n, &m);
rep1(i, n) {
char s[m + 1];
scanf("%s", s + 1);
rep1(j, m) a[i][j] = s[j] - '0';
}
int ansx = 1e9, ansy = 1e9;
rep1(i, n) rep1(j, m) {
if(a[i][j] == 0) continue;
int ptr = j;
while(ptr < m && a[i][ptr + 1] == 1) ptr ++;
ansx = min(ansx, ptr - j + 1);
j = ptr;
}
rep1(j, m) rep1(i, n) {
if(a[i][j] == 0) continue;
int ptr = i;
while(ptr < n && a[ptr + 1][j] == 1) ptr ++;
ansy = min(ansy, ptr - i + 1);
i = ptr;
}
printf("%d", ansx * ansy);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |