Submission #101385

# Submission time Handle Problem Language Result Execution time Memory
101385 2019-03-18T22:10:26 Z fadi57 Bomb (IZhO17_bomb) C++14
12 / 100
25 ms 2788 KB
#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;
int d[1000000];

ll dp[1005][10005];

ll c[100005];
ll n,m;
ll ar[100][100];
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=9999;ll b=9999;
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
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 11 ms 2304 KB Output is correct
4 Correct 8 ms 2304 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 304 KB Output isn't correct
10 Incorrect 2 ms 380 KB Output isn't correct
11 Incorrect 2 ms 384 KB Output isn't correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 3 ms 384 KB Output is correct
18 Incorrect 3 ms 384 KB Output isn't correct
19 Incorrect 4 ms 384 KB Output isn't correct
20 Incorrect 3 ms 384 KB Output isn't correct
21 Incorrect 3 ms 356 KB Output isn't correct
22 Incorrect 3 ms 384 KB Output isn't correct
23 Incorrect 2 ms 384 KB Output isn't correct
24 Incorrect 2 ms 384 KB Output isn't correct
25 Incorrect 3 ms 384 KB Output isn't correct
26 Correct 5 ms 384 KB Output is correct
27 Incorrect 4 ms 640 KB Output isn't correct
28 Incorrect 4 ms 512 KB Output isn't correct
29 Incorrect 4 ms 768 KB Output isn't correct
30 Incorrect 5 ms 512 KB Output isn't correct
31 Incorrect 5 ms 512 KB Output isn't correct
32 Incorrect 4 ms 512 KB Output isn't correct
33 Incorrect 5 ms 512 KB Output isn't correct
34 Incorrect 4 ms 384 KB Output isn't correct
35 Incorrect 5 ms 512 KB Output isn't correct
36 Incorrect 6 ms 768 KB Output isn't correct
37 Incorrect 3 ms 384 KB Output isn't correct
38 Incorrect 23 ms 2688 KB Output isn't correct
39 Incorrect 2 ms 384 KB Output isn't correct
40 Incorrect 9 ms 1280 KB Output isn't correct
41 Incorrect 2 ms 384 KB Output isn't correct
42 Incorrect 4 ms 384 KB Output isn't correct
43 Incorrect 13 ms 768 KB Output isn't correct
44 Incorrect 5 ms 768 KB Output isn't correct
45 Incorrect 16 ms 2688 KB Output isn't correct
46 Incorrect 13 ms 768 KB Output isn't correct
47 Incorrect 17 ms 2688 KB Output isn't correct
48 Incorrect 16 ms 2688 KB Output isn't correct
49 Incorrect 23 ms 2788 KB Output isn't correct
50 Incorrect 15 ms 2688 KB Output isn't correct
51 Incorrect 15 ms 2688 KB Output isn't correct
52 Incorrect 15 ms 2688 KB Output isn't correct
53 Incorrect 16 ms 2688 KB Output isn't correct
54 Incorrect 16 ms 2716 KB Output isn't correct
55 Incorrect 16 ms 2688 KB Output isn't correct
56 Incorrect 15 ms 2688 KB Output isn't correct
57 Incorrect 16 ms 2684 KB Output isn't correct
58 Incorrect 22 ms 2688 KB Output isn't correct
59 Incorrect 16 ms 2688 KB Output isn't correct
60 Incorrect 22 ms 2688 KB Output isn't correct
61 Incorrect 23 ms 2688 KB Output isn't correct
62 Incorrect 23 ms 2584 KB Output isn't correct
63 Incorrect 24 ms 2688 KB Output isn't correct
64 Incorrect 25 ms 2688 KB Output isn't correct
65 Incorrect 16 ms 2688 KB Output isn't correct
66 Incorrect 19 ms 2680 KB Output isn't correct
67 Incorrect 16 ms 2688 KB Output isn't correct
68 Incorrect 17 ms 2688 KB Output isn't correct
69 Incorrect 20 ms 2688 KB Output isn't correct
70 Incorrect 12 ms 768 KB Output isn't correct
71 Incorrect 13 ms 768 KB Output isn't correct
72 Incorrect 13 ms 768 KB Output isn't correct
73 Incorrect 13 ms 768 KB Output isn't correct
74 Incorrect 16 ms 768 KB Output isn't correct
75 Incorrect 13 ms 896 KB Output isn't correct
76 Incorrect 13 ms 768 KB Output isn't correct
77 Incorrect 18 ms 768 KB Output isn't correct
78 Incorrect 13 ms 768 KB Output isn't correct
79 Incorrect 13 ms 768 KB Output isn't correct
80 Incorrect 12 ms 768 KB Output isn't correct
81 Incorrect 14 ms 768 KB Output isn't correct
82 Incorrect 18 ms 768 KB Output isn't correct
83 Incorrect 14 ms 768 KB Output isn't correct
84 Incorrect 13 ms 768 KB Output isn't correct
85 Incorrect 17 ms 768 KB Output isn't correct
86 Incorrect 12 ms 768 KB Output isn't correct
87 Incorrect 12 ms 768 KB Output isn't correct
88 Incorrect 19 ms 768 KB Output isn't correct
89 Incorrect 13 ms 768 KB Output isn't correct
90 Incorrect 11 ms 768 KB Output isn't correct
91 Incorrect 16 ms 768 KB Output isn't correct
92 Incorrect 12 ms 768 KB Output isn't correct
93 Incorrect 12 ms 768 KB Output isn't correct
94 Incorrect 14 ms 768 KB Output isn't correct
95 Incorrect 13 ms 844 KB Output isn't correct
96 Incorrect 20 ms 768 KB Output isn't correct
97 Incorrect 14 ms 832 KB Output isn't correct
98 Incorrect 14 ms 768 KB Output isn't correct
99 Incorrect 19 ms 768 KB Output isn't correct
100 Incorrect 13 ms 768 KB Output isn't correct