답안 #833173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833173 2023-08-22T02:44:55 Z vjudge1 Bomb (IZhO17_bomb) C++17
24 / 100
96 ms 27504 KB
#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;
            }

        }
        if(curr > 0) chmin(w, curr);

    }

    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;
            }

        }
        if(curr > 0) chmin(l, curr);
        
    }

    // cout << w << " " << l << endl;

    cout << w * l << endl;

}

int main(){

    fastIO();

    int t = 1;
    // cin >> t;
    while(t--) solve();

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 4 ms 10324 KB Output is correct
4 Correct 4 ms 10324 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Incorrect 0 ms 340 KB Output isn't correct
9 Incorrect 0 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 Correct 0 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 0 ms 340 KB Output isn't correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 0 ms 596 KB Output is correct
18 Incorrect 0 ms 596 KB Output isn't correct
19 Incorrect 0 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 1 ms 596 KB Output isn't correct
23 Incorrect 1 ms 724 KB Output isn't correct
24 Incorrect 0 ms 596 KB Output isn't correct
25 Incorrect 1 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 1 ms 2260 KB Output isn't correct
30 Incorrect 2 ms 2772 KB Output isn't correct
31 Incorrect 1 ms 2260 KB Output isn't correct
32 Incorrect 1 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 Correct 2 ms 2900 KB Output is correct
37 Incorrect 1 ms 340 KB Output isn't correct
38 Correct 67 ms 24808 KB Output is correct
39 Incorrect 0 ms 340 KB Output isn't correct
40 Incorrect 5 ms 6844 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 75 ms 24812 KB Output is correct
44 Incorrect 2 ms 2900 KB Output isn't correct
45 Incorrect 75 ms 24804 KB Output isn't correct
46 Correct 69 ms 24804 KB Output is correct
47 Incorrect 71 ms 24868 KB Output isn't correct
48 Incorrect 65 ms 24816 KB Output isn't correct
49 Correct 72 ms 24804 KB Output is correct
50 Incorrect 70 ms 24808 KB Output isn't correct
51 Incorrect 77 ms 24804 KB Output isn't correct
52 Incorrect 80 ms 24808 KB Output isn't correct
53 Incorrect 72 ms 24796 KB Output isn't correct
54 Incorrect 88 ms 24828 KB Output isn't correct
55 Incorrect 94 ms 24800 KB Output isn't correct
56 Correct 75 ms 24804 KB Output is correct
57 Incorrect 87 ms 25004 KB Output isn't correct
58 Incorrect 73 ms 25168 KB Output isn't correct
59 Incorrect 79 ms 25184 KB Output isn't correct
60 Correct 76 ms 25312 KB Output is correct
61 Correct 78 ms 25576 KB Output is correct
62 Correct 69 ms 25484 KB Output is correct
63 Correct 76 ms 25552 KB Output is correct
64 Correct 83 ms 25952 KB Output is correct
65 Incorrect 77 ms 25880 KB Output isn't correct
66 Incorrect 75 ms 25960 KB Output isn't correct
67 Incorrect 71 ms 25960 KB Output isn't correct
68 Incorrect 76 ms 25964 KB Output isn't correct
69 Incorrect 83 ms 26080 KB Output isn't correct
70 Incorrect 43 ms 21328 KB Output isn't correct
71 Incorrect 78 ms 26264 KB Output isn't correct
72 Incorrect 87 ms 26344 KB Output isn't correct
73 Incorrect 73 ms 26340 KB Output isn't correct
74 Incorrect 87 ms 26424 KB Output isn't correct
75 Incorrect 80 ms 26340 KB Output isn't correct
76 Incorrect 83 ms 26252 KB Output isn't correct
77 Incorrect 80 ms 26476 KB Output isn't correct
78 Incorrect 76 ms 26592 KB Output isn't correct
79 Incorrect 74 ms 26720 KB Output isn't correct
80 Incorrect 81 ms 26676 KB Output isn't correct
81 Incorrect 85 ms 26852 KB Output isn't correct
82 Incorrect 96 ms 26860 KB Output isn't correct
83 Incorrect 76 ms 26780 KB Output isn't correct
84 Incorrect 69 ms 26756 KB Output isn't correct
85 Incorrect 73 ms 26856 KB Output isn't correct
86 Incorrect 69 ms 26800 KB Output isn't correct
87 Incorrect 75 ms 26848 KB Output isn't correct
88 Incorrect 74 ms 26852 KB Output isn't correct
89 Incorrect 78 ms 26976 KB Output isn't correct
90 Incorrect 54 ms 22040 KB Output isn't correct
91 Incorrect 85 ms 27016 KB Output isn't correct
92 Incorrect 78 ms 27048 KB Output isn't correct
93 Incorrect 77 ms 27172 KB Output isn't correct
94 Incorrect 82 ms 27168 KB Output isn't correct
95 Incorrect 75 ms 27364 KB Output isn't correct
96 Incorrect 77 ms 27468 KB Output isn't correct
97 Incorrect 88 ms 27488 KB Output isn't correct
98 Incorrect 79 ms 27504 KB Output isn't correct
99 Incorrect 81 ms 27484 KB Output isn't correct
100 Incorrect 70 ms 27420 KB Output isn't correct