QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#189816#5473. Move One CoinGenshinImpactsFault#WA 7ms6404kbC++172.9kb2023-09-27 22:47:012023-09-27 22:47:03

Judging History

你现在查看的是最新测评结果

  • [2023-09-27 22:47:03]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:6404kb
  • [2023-09-27 22:47:01]
  • 提交

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;
            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: 2ms
memory: 5432kb

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: 0ms
memory: 5448kb

input:

3 3
xox
oxo
xox
4 4
oxxx
xxox
xoxo
xxxx

output:

1 2
-1 -1

result:

ok OK! rot=0

Test #3:

score: 0
Accepted
time: 3ms
memory: 3468kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 498
0 0

result:

ok OK! rot=0

Test #4:

score: 0
Accepted
time: 3ms
memory: 5612kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0
498 498

result:

ok OK! rot=0

Test #5:

score: 0
Accepted
time: 5ms
memory: 3588kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

497 1
0 499

result:

ok OK! rot=0

Test #6:

score: 0
Accepted
time: 5ms
memory: 5496kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 499
497 1

result:

ok OK! rot=0

Test #7:

score: 0
Accepted
time: 6ms
memory: 6404kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 498
-498 996

result:

ok OK! rot=3

Test #8:

score: 0
Accepted
time: 7ms
memory: 5976kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0
498 498

result:

ok OK! rot=1

Test #9:

score: 0
Accepted
time: 3ms
memory: 5660kb

input:

500 500
xooxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

1 0
-497 -498

result:

ok OK! rot=0

Test #10:

score: -100
Wrong Answer
time: 5ms
memory: 5452kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

497 499
499 499

result:

wrong answer Pattern did not match after movement