by 18949691400加油! @ 2018-12-03 19:44:17
有道理
by 已注销%Jm9VScx @ 2018-12-03 19:49:09
然后我A了
by 已注销%Jm9VScx @ 2018-12-03 19:51:05
l
by 影刺暴君 @ 2019-07-03 09:34:43
```cpp
#include <iostream>
#include <algorithm>
using namespace std;
const int RN = 1e3 + 10, RM = 1e6 + 10;
int n, xi;
int x[RM], y[RM], r[RM];
char f[RN][RN], ch;
bool cmp(int a, int b) {
if (x[a] != x[b]) return x[a] < x[b];
return y[a] < y[b];
}
void fun() {
sort(r + 1, r + xi + 1, cmp);
for (int i = 1; i <= xi; ++i) {
cout << f[x[r[i]]][y[r[i]]];
int tmp = x[r[i]];
x[r[i]] = y[r[i]], y[r[i]] = n + 1 - tmp;
}
}
int main() {
cin >> n;
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
cin >> ch;
if (ch == 'O') x[++xi] = i, y[xi] = j;
}
for (int i = 1; i <= n; ++i)
for (int j = 1; j <= n; ++j) {
cin >> f[i][j];
}
for (int i = 1; i <= xi; ++i) r[i] = i;
for (int i = 1; i <= 4; ++i) fun();
return 0;
}
```
by Tianxn @ 2020-12-03 10:31:56