#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const int MOD = 1000000007;
const int dx[] = {0, 0, 1, -1, 1, -1, -1, 1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define lsort(x) sort(all(x))
#define gsort(x) sort(all(x), greater<>())
#define rev(x) reverse(all(x))
#define mset(x, y) memset(x, y, sizeof(x))
#define vin(x, y) for(int i = 0; i < y; i++){decltype(x)::value_type temp; cin >> temp; x.pb(temp);}
#define vout(x) for(auto i : x){cout << i << " ";} cout << endl;
#define decide(x) if(x){ cout << "YES" << endl; }else{ cout << "NO" << endl; }
#define test(x) cout << "..." << endl
template<typename T> void chmin(T& x, T y) {if(x > y) x = y;}
template<typename T> void chmax(T& x, T y) {if(x < y) x = y;}
void fastIO(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int n, m;
int arr[2500][2500];
void solve(){
//IO
cin >> n >> m;
for(int i = 0; i < n; i++){
string temp;
cin >> temp;
for(int j = 0; j < m; j++) arr[i][j] = temp[j] - '0';
}
ll w = LLONG_MAX;
ll l = LLONG_MAX;
for(int i = 0; i < n; i++){
ll curr = 0;
for(int j = 0; j < m; j++){
if(arr[i][j] == 1) curr++;
else{
if(curr > 0) chmin(w, curr);
curr = 0;
}
}
}
for(int i = 0; i < m; i++){
ll curr = 0;
for(int j = 0; j < n; j++){
if(arr[j][i] == 1) curr++;
else{
if(curr > 0) chmin(l, curr);
curr = 0;
}
}
}
cout << w * l << endl;
}
int main(){
fastIO();
int t = 1;
// cin >> t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
3 |
Incorrect |
3 ms |
10324 KB |
Output isn't correct |
4 |
Incorrect |
3 ms |
10324 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
17 |
Correct |
0 ms |
596 KB |
Output is correct |
18 |
Incorrect |
0 ms |
596 KB |
Output isn't correct |
19 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
724 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
468 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
596 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
724 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
596 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
724 KB |
Output isn't correct |
26 |
Correct |
1 ms |
724 KB |
Output is correct |
27 |
Correct |
1 ms |
1748 KB |
Output is correct |
28 |
Incorrect |
1 ms |
1876 KB |
Output isn't correct |
29 |
Incorrect |
2 ms |
2388 KB |
Output isn't correct |
30 |
Incorrect |
3 ms |
2772 KB |
Output isn't correct |
31 |
Incorrect |
1 ms |
2260 KB |
Output isn't correct |
32 |
Incorrect |
2 ms |
2516 KB |
Output isn't correct |
33 |
Incorrect |
2 ms |
2900 KB |
Output isn't correct |
34 |
Incorrect |
1 ms |
2004 KB |
Output isn't correct |
35 |
Incorrect |
2 ms |
2900 KB |
Output isn't correct |
36 |
Incorrect |
2 ms |
2900 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
38 |
Incorrect |
49 ms |
24760 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
40 |
Incorrect |
5 ms |
6868 KB |
Output isn't correct |
41 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
42 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
43 |
Correct |
50 ms |
24748 KB |
Output is correct |
44 |
Incorrect |
2 ms |
2900 KB |
Output isn't correct |
45 |
Incorrect |
53 ms |
24808 KB |
Output isn't correct |
46 |
Correct |
55 ms |
24744 KB |
Output is correct |
47 |
Incorrect |
53 ms |
24804 KB |
Output isn't correct |
48 |
Incorrect |
60 ms |
24808 KB |
Output isn't correct |
49 |
Correct |
54 ms |
24804 KB |
Output is correct |
50 |
Incorrect |
54 ms |
24808 KB |
Output isn't correct |
51 |
Incorrect |
60 ms |
24800 KB |
Output isn't correct |
52 |
Incorrect |
45 ms |
24808 KB |
Output isn't correct |
53 |
Incorrect |
61 ms |
24816 KB |
Output isn't correct |
54 |
Incorrect |
49 ms |
24788 KB |
Output isn't correct |
55 |
Incorrect |
48 ms |
24808 KB |
Output isn't correct |
56 |
Incorrect |
47 ms |
24788 KB |
Output isn't correct |
57 |
Incorrect |
50 ms |
24808 KB |
Output isn't correct |
58 |
Incorrect |
44 ms |
24788 KB |
Output isn't correct |
59 |
Incorrect |
48 ms |
24788 KB |
Output isn't correct |
60 |
Correct |
49 ms |
24788 KB |
Output is correct |
61 |
Incorrect |
44 ms |
24780 KB |
Output isn't correct |
62 |
Correct |
46 ms |
24908 KB |
Output is correct |
63 |
Correct |
50 ms |
24808 KB |
Output is correct |
64 |
Correct |
55 ms |
24804 KB |
Output is correct |
65 |
Incorrect |
51 ms |
24788 KB |
Output isn't correct |
66 |
Incorrect |
53 ms |
24744 KB |
Output isn't correct |
67 |
Incorrect |
58 ms |
24720 KB |
Output isn't correct |
68 |
Incorrect |
58 ms |
24788 KB |
Output isn't correct |
69 |
Incorrect |
54 ms |
24768 KB |
Output isn't correct |
70 |
Incorrect |
30 ms |
19916 KB |
Output isn't correct |
71 |
Incorrect |
51 ms |
24788 KB |
Output isn't correct |
72 |
Incorrect |
51 ms |
24788 KB |
Output isn't correct |
73 |
Incorrect |
49 ms |
24800 KB |
Output isn't correct |
74 |
Incorrect |
51 ms |
24908 KB |
Output isn't correct |
75 |
Incorrect |
61 ms |
24804 KB |
Output isn't correct |
76 |
Incorrect |
62 ms |
24800 KB |
Output isn't correct |
77 |
Incorrect |
52 ms |
24788 KB |
Output isn't correct |
78 |
Incorrect |
47 ms |
24788 KB |
Output isn't correct |
79 |
Incorrect |
50 ms |
24820 KB |
Output isn't correct |
80 |
Incorrect |
47 ms |
24808 KB |
Output isn't correct |
81 |
Incorrect |
49 ms |
24788 KB |
Output isn't correct |
82 |
Incorrect |
48 ms |
24752 KB |
Output isn't correct |
83 |
Incorrect |
43 ms |
24788 KB |
Output isn't correct |
84 |
Incorrect |
51 ms |
24788 KB |
Output isn't correct |
85 |
Incorrect |
56 ms |
24808 KB |
Output isn't correct |
86 |
Incorrect |
57 ms |
24788 KB |
Output isn't correct |
87 |
Incorrect |
40 ms |
24808 KB |
Output isn't correct |
88 |
Incorrect |
48 ms |
24804 KB |
Output isn't correct |
89 |
Incorrect |
49 ms |
24800 KB |
Output isn't correct |
90 |
Incorrect |
34 ms |
20052 KB |
Output isn't correct |
91 |
Incorrect |
42 ms |
24812 KB |
Output isn't correct |
92 |
Incorrect |
39 ms |
24704 KB |
Output isn't correct |
93 |
Incorrect |
58 ms |
24804 KB |
Output isn't correct |
94 |
Incorrect |
54 ms |
24800 KB |
Output isn't correct |
95 |
Incorrect |
49 ms |
24788 KB |
Output isn't correct |
96 |
Incorrect |
49 ms |
24808 KB |
Output isn't correct |
97 |
Incorrect |
49 ms |
24808 KB |
Output isn't correct |
98 |
Incorrect |
52 ms |
24716 KB |
Output isn't correct |
99 |
Incorrect |
51 ms |
24748 KB |
Output isn't correct |
100 |
Incorrect |
45 ms |
24788 KB |
Output isn't correct |