QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103101#5473. Move One Coin8BQube#RE 4ms7532kbC++172.3kb2023-05-04 14:32:002023-05-04 14:32:02

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-04 14:32:02]
  • 评测
  • 测评结果:RE
  • 用时:4ms
  • 内存:7532kb
  • [2023-05-04 14:32:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define SZ(a) ((int)a.size())
#define pb push_back
#define ALL(v) v.begin(), v.end()

vector<pii> rd() {
    int h, w;
    cin >> h >> w;
    vector<pii> res;
    for (int i = 0; i < h; i++) {
        string s;
        cin >> s;
        for (int j =0 ; j < w; j++)
            if (s[j] == 'o')
                res.pb({j, i});
    }
    return res;
}

const int C = 2000;
int mp[2 * C][2 * C];

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    auto v1 = rd();
    auto v2 = rd();
    assert(SZ(v1) == SZ(v2));
    for (int kz = 0; kz < 4; kz++) {
        vector<int> x1, y1;
        for (auto [x, y] : v1)
            x1.pb(x), y1.pb(x);
        sort(ALL(x1));
        sort(ALL(y1));
        vector<int> x2, y2;
        for (auto [x, y] : v2)
            x2.pb(x), y2.pb(y);
        sort(ALL(x2));
        sort(ALL(y2));

        x1.resize(min(SZ(x1), 2));
        x2.resize(min(SZ(x2), 2));
        y1.resize(min(SZ(y1), 2));
        y2.resize(min(SZ(y2), 2));


        for (int a : x1)
            for (int b : x2)
                for (int c : y1)
                    for (int d : y2) {
                        int dx = b - a;
                        int dy = d - c;
                        vector<pii> mis;
                        vector<pii> cur;
                        for (auto [x, y] : v2)
                            mp[x + C][y + C] = 1;
                        for (auto [x, y] : v1) {
                            if (mp[x + dx + C][y + dy + C])
                                mp[x + dx + C][y + dy + C] = 0;         
                            else
                                mis.pb({x, y});
                        }
                        for (auto [x, y] : v2)
                            if (mp[x + C][y + C])
                                mp[x + C][y + C] = 0, cur.pb({x, y});
                        assert(SZ(cur) == SZ(mis));
                        if (SZ(cur) == 1) {
                            cout << mis[0].X << " " << mis[0].Y << "\n";
                            cout << cur[0].X - dx << " " << cur[0].Y - dy << "\n";
                            exit(0);
                        }
                    }

        for (auto &p : v2)
            p = {p.Y, -p.X};
    }
    assert(0);
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 5444kb

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

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: 4ms
memory: 7532kb

input:

500 500
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

498 498
0 0

result:

ok OK! rot=0

Test #4:

score: -100
Dangerous Syscalls

input:

500 500
oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:


result: