-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEma_Supercomputer.cpp
138 lines (131 loc) · 3.54 KB
/
Ema_Supercomputer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
const ll mod = 1000000007;
const ll inf = 1e18;
#define FIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
#define all(x) begin(x), end(x)
#define loop(i, n) for (int i = 0; i < n; i++)
#define print_array(arr) \
loop(z, sizeof(arr) / sizeof(arr[0])) cout << arr[z] << " "; \
cout << "\n"
#define print_vector(vvv) \
loop(z, vvv.size()) cout << vvv[z] << " "; \
cout << "\n"
#define print_vector_pair(vvv) \
loop(z, vvv.size()) cout << vvv[z].first << " " vvv[z].second << "\n"; \
cout << "\n"
#define fill_my(arr, q) fill(all(arr), q)
#define delete_by_value(vec, val) vec.erase(std::remove(vec.begin(), vec.end(), val), vec.end());
void test_case()
{
int n, m;
cin >> n >> m;
char arr[n][m];
int max[n][m];
// fill_my(max,0);
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> arr[i][j];
if (arr[i][j] == 'G')
{
max[i][j] = 1;
}
else
{
max[i][j] = 0;
}
}
}
// for (int i = 0; i < n; i++)
// {
// for (int j = 0; j < m; j++)
// {
// cout << arr[i][j] << " ";
// }
// cout << endl;
// }
vector<int> v;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (arr[i][j] == 'G')
{
int ii = i, jj = j, pointer = 1;
int maxi = 1;
while (((ii - pointer) >= 0) && ((jj - pointer) >= 0) && ((jj + pointer) < m) && ((ii + pointer) < n))
{
cout << pointer << endl;
// int maxi = 0;
if ((arr[ii - pointer][jj] == 'G') && (arr[ii][jj - pointer] == 'G') && (arr[ii][jj + pointer] == 'G') && (arr[ii + pointer][jj] == 'G'))
{
cout << "True" << endl;
maxi += 4;
max[i][j] = maxi;
pointer++;
}
else
{
cout << "False" << endl;
// maxi += 1;
max[i][j] = maxi;
break;
}
}
}
}
}
print_vector(v);
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << max[i][j] << " ";
}
cout << endl;
}
// int answer = 0;
// int l = v.size();
// if (l > 0)
// {
// sort(v.begin(), v.end());
// }
// if (v.size() == 0)
// {
// answer = 1;
// }
// else if (v.size() == 1)
// {
// answer = v[0];
// }
// else
// {
// answer = (v[v.size() - 1] * 2 + 1) * (v[v.size() - 2] * 2 + 1);
// }
// cout << answer << endl;
// ;
//cout <<a<<"\n";
}
int main()
{
// clock_t time_req;
// time_req = clock();
FIO;
int t = 1;
// cin >> t;
for (int i = 1; i <= t; i++)
{
// cout << "Case #" << i << ": ";
test_case();
}
// time_req = clock() - time_req;
// cout << "\nProcessor time " << (float)time_req / CLOCKS_PER_SEC<< " sec" << endl;
return 0;
}