QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#189819 | #5473. Move One Coin | GenshinImpactsFault# | WA | 8ms | 6644kb | C++17 | 3.0kb | 2023-09-27 22:50:16 | 2023-09-27 22:50:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
const int N = 510;
int n, m, nn, mm;
int a[N][N], b[N][N], c[N][N];
pii aa[2], bb[2];
int la, lb;
bool gval(int x, int y) {
if(x < 1 || y < 1 || x > n || y > m) return 0;
return a[x][y];
}
void solve() {
// for(int i = 1; i <= n; i++) {
// for(int j = 1; j <= m; j++) cout << a[i][j];
// cout << "\n";
// }
// cout << "\n";
// for(int i = 1; i <= nn; i++) {
// for(int j = 1; j <= mm; j++) cout << b[i][j];
// cout << "\n";
// }
// cout << "\n";
la = lb = 0;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= m; j++)
if(a[i][j]) {
aa[la++] = {i, j};
if(la == 2) break;
}
if(la == 2) break;
}
for(int i = 1; i <= nn; i++) {
for(int j = 1; j <= mm; j++)
if(b[i][j]) {
bb[lb++] = {i, j};
if(lb == 2) break;
}
if(lb == 2) break;
}
int dx, dy, ax, ay, sx, sy;
for(int ii = 0; ii < 2; ii++)
for(int jj = 0; jj < 2; jj++) {
dx = aa[ii].first - bb[jj].first;
dy = aa[ii].second - bb[jj].second;
int cnt = 0;
if(ii == 1) sx = aa[0].first, sy = aa[0].second, ++cnt;
if(jj == 1) ax = bb[0].first, ay = bb[0].second, ++cnt;
for(int i = 1; i <= nn; i++)
for(int j = 1; j <= mm; j++) {
if(b[i][j] ^ gval(i + dx, j + dy)) ++cnt;
if(b[i][j] && !gval(i + dx, j + dy))
ax = i + dx, ay = j + dy;
if(!b[i][j] && gval(i + dx, j + dy))
sx = i + dx, sy = j + dy;
}
if(cnt > 2) continue;
cout << sy - 1 << " " << sx - 1 << "\n";
cout << ay - 1 << " " << ax - 1 << "\n";
exit(0);
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(nullptr);
cin >> n >> m;
int cnt = 0;
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++) {
char c; cin >> c;
for(; c != 'x' && c != 'o'; cin >> c);
if(c == 'o') a[i][j] = 1, ++cnt;
}
cin >> nn >> mm;
for(int i = 1; i <= nn; i++)
for(int j = 1; j <= mm; j++) {
char c; cin >> c;
for(; c != 'x' && c != 'o'; cin >> c);
if(c == 'o') b[i][j] = 1;
}
if(cnt == 1) {
for(int i = 1; i <= n; i++)
for(int j = 1; j <= m; j++)
if(a[i][j]) {
cout << j - 1 << " " << i - 1 << "\n" << j - 1 << " " << i - 1 << "\n";
exit(0);
}
}
for(int h = 0; h < 4; h++) {
solve();
for(int i = 1; i <= nn; i++)
for(int j = 1; j <= mm; j++)
c[mm - j + 1][i] = b[i][j];
swap(b, c);
swap(nn, mm);
}
cout << "QAQ\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5716kb
input:
2 3 xox ooo 4 2 ox ox ox ox
output:
1 0 3 1
result:
ok OK! rot=1
Test #2:
score: 0
Accepted
time: 1ms
memory: 6132kb
input:
3 3 xox oxo xox 4 4 oxxx xxox xoxo xxxx
output:
2 1 -1 3
result:
ok OK! rot=3
Test #3:
score: 0
Accepted
time: 8ms
memory: 5656kb
input:
500 500 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
498 499 996 997
result:
ok OK! rot=2
Test #4:
score: -100
Wrong Answer
time: 7ms
memory: 6644kb
input:
500 500 oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
output:
QAQ
result:
wrong output format Expected integer, but "QAQ" found