# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
145505 | MladenP | Bomb (IZhO17_bomb) | C++17 | 112 ms | 18936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define STIZE(x) fprintf(stderr, "STIZE%d\n", x);
#define PRINT(x) fprintf(stderr, "%s = %d\n", #x, x);
#define NL(x) printf("%c", " \n"[(x)]);
#define lld long long
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define mid (l+r)/2
#define endl '\n'
#define all(a) begin(a),end(a)
#define sz(a) int((a).size())
#define LINF 1000000000000000LL
#define INF 1000000000
#define EPS 1e-9
using namespace std;
string s[2510];
int N, M;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
cin >> N >> M;
s[0] = string(M+2, '0');
for(int i = 1; i <= N; i++) {
cin >> s[i];
s[i] = '0' + s[i] + '0';
}
s[N+1] = string(M+2, '0');
int cur = 0, najmX = INF, najmY = INF;
for(int i = 1; i <= N; i++) {
for(int j = 1; j <= M+1; j++) {
if(s[i][j] == '1') cur++;
if(s[i][j] == '0' && s[i][j-1] == '1') najmX = min(najmX, cur);
if(s[i][j] == '0') cur = 0;
}
}
cur = 0;
for(int j = 1; j <= M; j++) {
for(int i = 1; i <= N+1; i++) {
if(s[i][j] == '1') cur++;
if(s[i][j] == '0' && s[i-1][j] == '1') najmY = min(najmY, cur);
if(s[i][j] == '0') cur = 0;
}
}
cout << najmX*najmY;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |