# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
333907 | tengiz05 | Bomb (IZhO17_bomb) | C++17 | 251 ms | 67948 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>
using namespace std;
#define int long long
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define PI acos(-1)
#define ld long double
const int mod = 1e9+7, N = 2505;
int msb(int val){return sizeof(int)*8-__builtin_clzll(val);}
int a[N][N], n, m, k;
bool usedup[N][N], usedr[N][N];
void solve(int test_case){
int i, j;
cin >> n >> m;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
char c;
cin >> c;
a[i][j] = (c-'0');
}
}
int mx=mod, my=mod;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
if(a[i][j] == 1){
if(usedup[i][j])continue;
int t = j;
int tmp = 0;
while(t <= m && a[i][t] == 1){
tmp++;
usedup[i][t] = true;
t++;
}mx = min(mx, tmp);
}
}
}
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
if(a[i][j] == 1){
if(usedr[i][j])continue;
int t = i;
int tmp = 0;
while(t <= n && a[t][j] == 1){
tmp++;
usedr[t][j] = true;
t++;
}my = min(my, tmp);
}
}
}
// cout << mx << ' ' << my << '\n';
cout << mx*my << '\n';
return;
}
signed main(){
FASTIO;
#define MULTITEST 0
#if MULTITEST
int ___T;
cin >> ___T;
for(int T_CASE = 1; T_CASE <= ___T; T_CASE++)
solve(T_CASE);
#else
solve(1);
#endif
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |