QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189825#5473. Move One CoinGenshinImpactsFault#WA 8ms5720kbC++173.2kb2023-09-27 23:18:082023-09-27 23:18:09

Judging History

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

  • [2023-09-27 23:18:09]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:5720kb
  • [2023-09-27 23:18:08]
  • 提交

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;

int gval(int x, int y) {
    if(x < 1 || y < 1 || x > n || y > m) return 0;
    return a[x][y];
}
void solve() {
    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;
            assert(cnt != 1);
            if(cnt == 0) {
                ax = aa[ii].first, ay = aa[ii].second;
                sx = aa[ii].first, sy = aa[ii].second;
            }
            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;
        }
    // 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";
    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);
                }
        return 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(nn, mm);
        for(int i = 1; i <= nn; i++)
            for(int j = 1; j <= mm; j++)
                b[i][j] = c[i][j];
    }
    assert(0);
    return 0;
}
// 1 3
// xoo
// 5 1
// x
// x
// x
// o
// o

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3464kb

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: 3452kb

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

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 498
0 0

result:

ok OK! rot=0

Test #4:

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

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0
498 498

result:

ok OK! rot=0

Test #5:

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

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

497 1
0 499

result:

ok OK! rot=0

Test #6:

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

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 499
497 1

result:

ok OK! rot=0

Test #7:

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

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 498
-498 996

result:

ok OK! rot=3

Test #8:

score: 0
Accepted
time: 8ms
memory: 5464kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0 0
498 498

result:

ok OK! rot=1

Test #9:

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

input:

500 500
xooxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

1 0
-497 -498

result:

ok OK! rot=0

Test #10:

score: -100
Wrong Answer
time: 2ms
memory: 5456kb

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

497 499
499 499

result:

wrong answer Pattern did not match after movement