# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833529 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 63 ms | 19156 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define pf push_front
#define p push
#define q queue
#define popf pop_front()
#define popb pop_back()
#define dq deque
#define fi first
#define se second
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define pq priority_queue
#define st stack
#define rep(i,a,b) for (ll i=a; i<b; i++)
#define rept(i,a,b) for (ll i=a; i<=b; i++)
#define repr(i,a,b) for (ll i=a; i>=b; i--)
#define ppi pair<ll,ll>
#define test cout<<"A"<<endl
using namespace std;
ll a,b;
ve<string> mp;
ve<string> hor;
ve<string> ver;
int main(){
ios_base::sync_with_stdio(false);
// cin.tie(NULL);
cin>>a>>b;
rep(i,0,a){
string s;
cin>>s;
mp.pb(s);
hor.pb(s);
ver.pb(s);
}
rep(i,0,a){
rep(j,0,b){
if (mp[i][j] == '1'){
if (i != 0){
ver[i][j]+= ver[i-1][j]-'0';
ver[i-1][j] = '0';
}
if (j != 0){
hor[i][j]+= hor[i][j-1]-'0';
hor[i][j-1] = '0';
}
}
}
}
ll ans = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = ver[i][j]-'0';
if (temp == 0) temp = 99999;
ans = min(ans, temp);
}
}
ll k = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = hor[i][j]-'0';
if (temp == 0) temp = 99999;
k = min(k, temp);
}
}
cout<<ans*k<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |