-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1985D.cpp
More file actions
32 lines (27 loc) · 723 Bytes
/
1985D.cpp
File metadata and controls
32 lines (27 loc) · 723 Bytes
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
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<n;i++)
int main() {
int t;
cin >> t;
while (t-- > 0) {
int n, m;
cin >> n >> m;
vector<string> grid(n);
int firstRow = -1, lastRow = -1, midCol = -1;
rep(i, n) {
cin >> grid[i];
rep(j, m) {
if (grid[i][j] == '#') {
if (firstRow == -1) {
firstRow = i;
midCol = j;
}
lastRow = i;
}
}
}
int midRow = (firstRow + lastRow) / 2;
cout << midRow + 1 << " " << midCol + 1 << endl;
}
}