답안 #833649

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833649 2023-08-22T07:27:32 Z vjudge1 Bomb (IZhO17_bomb) C++17
24 / 100
155 ms 104964 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

// os.erase(os.find_by_order(os.order_of_key(val)));
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MAX LLONG_MAX
#define MOD 1000000007
#define int long long
#define ll __int128
#define endl '\n'
#define fi first
#define se second
#define pii pair<int, int>
#define pb push_back
#define all(x) x.begin(), x.end()
#define pv(x) for (auto i : x) cout << i << ' '; cout << endl;
#define vini(x, y) for (int i = 0; i < y; i++) cin >> x[i];
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a * (b / gcd(a,b)))
#define countonbit(a) __builtin_popcountll(a)

using namespace std;

void solve()
{
	int a, b; cin >> a >> b;
	vector <string> arr(a);
	vini(arr, a);
	int counter = 0;
	int x = b, y = a;
	int dph[a][b];
	int dpv[a][b];
	
	for (int i = 0; i < a; i++)
	{
		for (int j = 0; j < b; j++)
		{
			dph[i][j] = -1;
			dpv[i][j] = -1;
		}
	}
		
	for (int i = 0; i < a; i++)
	{
		for (int j = 0; j < b; j++)
		{
			int count;
			if (arr[i][j] == '0') continue;
			if (dph[i][j] != -1) goto here;
			count = 0;
			for (int k = j; k < b; k++)
			{
				if (arr[i][k] == '0') break;
				dph[i][k] = 1;
				count++;
			}
			
			x = min(x, count);
			
			here:
			if (dpv[i][j] != -1) continue;
			
			count = 0;
			for (int k = i; k < a; k++)
			{
				if (arr[k][j] == '0') break;
				dpv[k][j] = 1;
				count++;
			}
			
			y = min(y, count);			
		}
	}	
	
	cout << x * y << endl;
}

int32_t main()
{
 	ios::sync_with_stdio(false); cin.tie(NULL);

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

Compilation message

bomb.cpp: In function 'void solve()':
bomb.cpp:31:6: warning: unused variable 'counter' [-Wunused-variable]
   31 |  int counter = 0;
      |      ^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 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 212 KB Output is correct
8 Incorrect 0 ms 212 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Incorrect 0 ms 212 KB Output isn't correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Incorrect 0 ms 212 KB Output isn't correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Incorrect 0 ms 212 KB Output isn't correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Incorrect 0 ms 340 KB Output isn't correct
19 Incorrect 0 ms 340 KB Output isn't correct
20 Incorrect 0 ms 340 KB Output isn't correct
21 Incorrect 0 ms 340 KB Output isn't correct
22 Incorrect 1 ms 340 KB Output isn't correct
23 Incorrect 0 ms 468 KB Output isn't correct
24 Incorrect 1 ms 340 KB Output isn't correct
25 Incorrect 0 ms 468 KB Output isn't correct
26 Correct 0 ms 468 KB Output is correct
27 Correct 1 ms 1620 KB Output is correct
28 Incorrect 1 ms 2144 KB Output isn't correct
29 Incorrect 2 ms 2388 KB Output isn't correct
30 Incorrect 2 ms 3412 KB Output isn't correct
31 Incorrect 2 ms 2772 KB Output isn't correct
32 Incorrect 2 ms 2900 KB Output isn't correct
33 Incorrect 2 ms 3668 KB Output isn't correct
34 Incorrect 1 ms 1620 KB Output isn't correct
35 Incorrect 3 ms 3796 KB Output isn't correct
36 Correct 2 ms 3668 KB Output is correct
37 Incorrect 0 ms 212 KB Output isn't correct
38 Correct 146 ms 104964 KB Output is correct
39 Incorrect 0 ms 212 KB Output isn't correct
40 Incorrect 10 ms 13192 KB Output isn't correct
41 Incorrect 1 ms 212 KB Output isn't correct
42 Incorrect 0 ms 468 KB Output isn't correct
43 Correct 113 ms 104772 KB Output is correct
44 Incorrect 2 ms 3668 KB Output isn't correct
45 Incorrect 104 ms 104864 KB Output isn't correct
46 Correct 74 ms 104868 KB Output is correct
47 Incorrect 102 ms 104776 KB Output isn't correct
48 Incorrect 89 ms 104836 KB Output isn't correct
49 Correct 153 ms 104800 KB Output is correct
50 Incorrect 92 ms 104832 KB Output isn't correct
51 Incorrect 92 ms 104872 KB Output isn't correct
52 Incorrect 91 ms 104940 KB Output isn't correct
53 Incorrect 93 ms 104796 KB Output isn't correct
54 Incorrect 75 ms 104872 KB Output isn't correct
55 Incorrect 69 ms 104760 KB Output isn't correct
56 Correct 154 ms 104868 KB Output is correct
57 Incorrect 72 ms 104868 KB Output isn't correct
58 Incorrect 72 ms 104840 KB Output isn't correct
59 Incorrect 71 ms 104876 KB Output isn't correct
60 Correct 91 ms 104780 KB Output is correct
61 Correct 155 ms 104868 KB Output is correct
62 Correct 131 ms 104748 KB Output is correct
63 Correct 143 ms 104872 KB Output is correct
64 Correct 76 ms 104788 KB Output is correct
65 Incorrect 99 ms 104812 KB Output isn't correct
66 Incorrect 90 ms 104876 KB Output isn't correct
67 Incorrect 95 ms 104844 KB Output isn't correct
68 Incorrect 93 ms 104792 KB Output isn't correct
69 Incorrect 66 ms 104840 KB Output isn't correct
70 Incorrect 44 ms 67196 KB Output isn't correct
71 Incorrect 61 ms 104872 KB Output isn't correct
72 Incorrect 64 ms 104780 KB Output isn't correct
73 Incorrect 75 ms 104872 KB Output isn't correct
74 Incorrect 68 ms 104764 KB Output isn't correct
75 Incorrect 66 ms 104868 KB Output isn't correct
76 Incorrect 65 ms 104804 KB Output isn't correct
77 Incorrect 67 ms 104876 KB Output isn't correct
78 Incorrect 64 ms 104884 KB Output isn't correct
79 Incorrect 53 ms 104868 KB Output isn't correct
80 Incorrect 53 ms 104808 KB Output isn't correct
81 Incorrect 54 ms 104836 KB Output isn't correct
82 Incorrect 66 ms 104780 KB Output isn't correct
83 Incorrect 65 ms 104744 KB Output isn't correct
84 Incorrect 56 ms 104844 KB Output isn't correct
85 Incorrect 65 ms 104868 KB Output isn't correct
86 Incorrect 142 ms 104816 KB Output isn't correct
87 Incorrect 70 ms 104872 KB Output isn't correct
88 Incorrect 69 ms 104864 KB Output isn't correct
89 Incorrect 100 ms 104808 KB Output isn't correct
90 Incorrect 40 ms 67204 KB Output isn't correct
91 Incorrect 76 ms 104864 KB Output isn't correct
92 Incorrect 88 ms 104868 KB Output isn't correct
93 Incorrect 140 ms 104928 KB Output isn't correct
94 Incorrect 92 ms 104740 KB Output isn't correct
95 Incorrect 67 ms 104860 KB Output isn't correct
96 Incorrect 72 ms 104864 KB Output isn't correct
97 Incorrect 144 ms 104872 KB Output isn't correct
98 Incorrect 73 ms 104824 KB Output isn't correct
99 Incorrect 114 ms 104808 KB Output isn't correct
100 Incorrect 137 ms 104876 KB Output isn't correct