0x00 Link
-
Source
-AtCoder
-
Tag
-芝士水题
-
Time
- ∗ * ∗
0x01 Source Code
//
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define y1 yL
const int N = 555;
char g[N][N];
void solve() {
int n, m;
cin >> n >> m;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= m; j++) {
cin >> g[i][j];
}
}
int x1 = 1, x2 = n, y1 = 1, y2 = m;
while (x1 < x2) {
bool f1 = 1, f2 = 1;
for (int j = 1; j <= m; j++) {
f1 &= (g[x1][j] == '.');
f2 &= (g[x2][j] == '.');
}
x1 += f1;
x2 -= f2;
if (f1 == 0 && f2 == 0) break;
}
while (y1 < y2) {
bool f1 = 1, f2 = 1;
for (int i = 1; i <= n; i++) {
f1 &= (g[i][y1] == '.');
f2 &= (g[i][y2] == '.');
}
y1 += f1;
y2 -= f2;
if (f1 == 0 && f2 == 0) break;
}
for (int i = x1; i <= x2; i++) {
for (int j = y1; j <= y2; j++) {
if (g[i][j] == '.') {
cout << i << " " << j << endl;
return ;
}
}
}
}
signed main() {
IOS
int t = 1;
// cin >> t;
while (t--) solve();
return 0;
}
0x10 Diagram
-
404
0x11 Reference
-
404
作者 | 乐意奥AI