# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833729 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 124 ms | 6552 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define For(i, n) for (int i = 0; i < n; i++)
#define pb push_back
const int INF = INT_MAX;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int N, M; cin >> N >> M;
char grid[N][M];
For (i, N) For (j, M) cin >> grid[i][j];
int row = INF, col = INF;
For (i, N) {
vector <int> one;
For (j, M) {
if (grid[i][j] == '1')
one.pb(j);
}
if (one.empty()) continue;
one.pb(-1);
int cnt = 1;
for (int j = 1; j < (int) one.size(); j++) {
if (one[j] == one[j - 1] + 1) cnt++;
else {
row = min(row, cnt);
cnt = 1;
}
}
}
For (j, M) {
vector <int> one;
For (i, N) {
if (grid[i][j] == '1') {
one.pb(i);
}
}
if (one.empty()) continue;
one.pb(-1);
int cnt = 1;
for (int j = 1; j < (int) one.size(); j++) {
if (one[j] == one[j - 1] + 1) cnt++;
else {
col = min(col, cnt);
cnt = 1;
}
}
}
if (row == col) row--;
cout << row * col << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |