# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
877331 | marcid | Bomb (IZhO17_bomb) | C++17 | 282 ms | 6840 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 2501;
char field[maxn][maxn];
int mn1=maxn,mn2=maxn;
int count(string s) {
int cnt = 0; int best = 0;
bool ret = false;
for (int i = 1; i < s.size(); i++) {
if (s[i] == '1' || s[i-1]=='1') ret=true;
if (s[i-1]==s[i] && s[i]=='1') cnt++;
else cnt=0;
best=max(best,cnt);
} return (ret ? best+1 : 0);
}
signed main() {
int n,m; cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> field[i][j];
}
} for (int i = 1; i <= n; i++) {
string t="";
for (int j = 1; j <= m; j++) t+=field[i][j];
mn1=min(mn1, count(t));
} for (int j = 1; j <= m; j++) {
string t="";
for (int i = 1; i <= n; i++) t+=field[i][j];
int x = count(t);
if (x>0) mn2=min(mn2, x);
}
cout << mn1 * mn2 << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |