-
Notifications
You must be signed in to change notification settings - Fork 0
/
799Div4 C
63 lines (54 loc) · 1.28 KB
/
799Div4 C
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
#include <bits/stdc++.h>
#define pi 3.141592653589793238462
#define mod 1000000007
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(), v.end()
#define acc(v) accumulate(all(v), 0)
#define pb push_back
#define isort(v) sort(all(v))
#define dsort(v) sort(v.rbegin(), v.rend())
#define in(v) for(auto &i : v) cin >> i
#define out(v) for(auto &i : v) cout << i << ' '
using namespace std;
int coo(string s){
int cnt = 0;
for(int i = 0; i < 8; i++){
if(s[i] == '#') cnt++;
}
return cnt;
}
void solve(){
vector<string> v(8);
int r = 0, c = 0;
vi cnt(8);
for(int i = 0; i < 8; i++) cin >> v[i];
for(int i = 0; i < 8; i++){
cnt[i] = count(all(v[i]), '#');
}
for(int i = 1; i < 7; i++){
if(cnt[i] == 1){
if(coo(v[i - 1]) == 2 && coo(v[i + 1]) == 2){
r = i + 1;
break;
}
}
}
string ans = v[r - 1];
for(int i = 0; i < 8; i++){
if(ans[i] == '#'){
c = i + 1;
break;
}
}
cout << r << " " << c << "\n";
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int t = 1;
cin >> t; // Comment this line if there is only one TC
while(t --> 0) solve();
return 0;
}