# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
39228 | yerkimbekov | Bomb (IZhO17_bomb) | C++14 | 166 ms | 8308 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.
/*
ID: simpgoo1
TASK:
LANG: C++14
*/
// timus 219263UI
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long ll;
#define y1 needtrainharder
#define F first
#define S second
#define gg exit(0)
#define sz() size()
#define pb push_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s,x) if(x == 1)freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"
const int INF = 1e9 + 100;
const ll INFLL = 1e18 + 100;
const double EPS = 1e-10;
const int MAXN = 5e5 + 100;
const int P = 51;
const int mod = 1e9 + 7;
char a[2505][2505];
int main(){
boost;
srand(time(NULL));
if(fopen(task".in", "r")){
freopen(task".in", "r", stdin);
freopen(task".out","w",stdout);
}
int n, m;
cin >> n >> m;
bool tr = 0;
for(int i = 1; i <= n; ++i){
for(int j = 1; j <= m; ++j){
cin >> a[i][j];
if( a[i][j] == '1' )
tr = 1;
}
}
if(!tr){
cout << 0;gg;
}
ll mnx = INFLL, mny = INFLL, cur = 0;
for(int i = 1; i <= n; ++i){
cur = 0;
for(int j = 1; j <= m; ++j){
if( a[i][j] == '1' )
++cur;
else{
if(cur != 0)
mnx = min(mnx, cur);
cur = 0;
}
}
if(cur != 0)
mnx = min(mnx, cur);
}
if(cur != 0)
mnx = min(mnx, cur);
cur = 0;
for(int j = 1; j <= m; ++j){
cur = 0;
for(int i = 1; i <= n; ++i){
if(a[i][j] == '1'){
++cur;
}else{
if(cur != 0)
mny = min(mny, cur);
cur = 0;
}
}
if(cur != 0)
mny = min(mny, cur);
}
if(cur != 0)
mny = min(mny, cur);
cout << mnx * 1ll * mny;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |