제출 #345423

#제출 시각아이디문제언어결과실행 시간메모리
345423balbitBomb (IZhO17_bomb)C++14
24 / 100
179 ms12780 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define f first
#define s second

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<": "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template<typename T> void _do(T && x){cerr<<x<<endl;}
template<typename T, typename ...S> void _do(T && x, S && ...y){cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define IOS() ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#define bug(...)
#endif

#define REP(i,n) for (int i = 0; i<n; ++i)
#define REP1(i,n) for (int i = 1; i<=n; ++i)

const int maxn = 2505;
bool b[maxn][maxn];

signed main(){
    IOS();
    bug(1,2);
    int n,m; cin>>n>>m;
    REP1(i,n) REP1(j,m) {
        char c; cin>>c; b[i][j] = c=='1';
    }
    int H = 10000000, W = 10000000;
    REP1(i,n) REP1(j,m) {
        if (b[i][j] && !b[i][j-1]) {
            int k = 0;
            for (int J = j; b[i][J]; ++J, ++k);
            W = min(W, k);
        }
        if (b[i][j] && !b[i-1][j]) {
            int k = 0;
            for (int I = i; b[I][j]; ++I, ++k);
            H = min(H, k);
        }
    }
    bug(H,W);
    if (H == 10000000) assert(0);
    cout<<H*(ll)W<<endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...