# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833155 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 84 ms | 6476 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<long long, long long>
#define pii pair<int,int>
#define fi first
#define se second
const ll MOD=1e9+7;
int n, m;
ll shortRow=MOD, shortCol=MOD;
void solve(){
cin >> n >> m;
char arr[n][m];
for(int i=0; i<n; i++){
bool counting=false;
ll cnt=0;
for(int j=0; j<m; j++){
cin >> arr[i][j];
if(arr[i][j]=='1'){
counting=true;
cnt++;
}
if(arr[i][j]=='0' && counting){
counting=false;
shortRow=min(shortRow,cnt);
cnt=0;
}
}
if(cnt!=0) shortRow=min(shortRow,cnt);
}
for(int i=0; i<n; i++){
bool counting=false;
ll cnt=0;
for(int j=0; j<m; j++){
if(arr[j][i]=='1'){
counting=true;
cnt++;
}
if(arr[j][i]=='0' && counting){
counting=false;
shortCol=min(shortCol,cnt);
cnt=0;
}
}
if(cnt!=0) shortCol=min(shortCol,cnt);
}
if(shortRow==MOD && shortCol==MOD){
shortRow=0;
shortCol=0;
}
cout << shortCol*shortRow << endl;
return;
}
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int q=1;
for(int i=0; i<q; i++){
solve();
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |