# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
101387 | fadi57 | Bomb (IZhO17_bomb) | C++14 | 1087 ms | 55468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define clr(i, j) memset(i, j, sizeof(i))
#define pb push_back
typedef long long ll;
//-*-*-*-*-*-*-*-*-
set<ll>s;
ll n,m;
ll ar[10000][2500];
bool valid(ll x ,ll y){
if(x<n&&y<m&&x>=0&&y>=0&&ar[x][y]==1){return 1;}
return 0;
}
int main()
{
cin>>n>>m;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
char c;
cin >> c;
ar[i][j] = c - '0';
}
}
ll a=99999999;ll b=99999999;
for(int i=0;i<n;i++){
for(ll l=0;l<m;l++){
ll k=1; ll f=1;
if(valid(i,l)){
ll t=l+1;
while(valid(i,t)){t++;k++;}
t=l-1;
while(valid(i,t)){t--;k++;}
ll d=i-1;
while(valid(d,l)){d--;f++;}
d=i+1;
while(valid(d,l)){d++;f++;}
a=min(k,a);b=min(f,b);
//if(f==1){cout<<i<<l;return 0;}
}
}
}
cout<<a*b;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |