QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#791791 | #5473. Move One Coin | MEshooter | WA | 0ms | 3596kb | C++20 | 2.1kb | 2024-11-28 20:56:34 | 2024-11-28 20:56:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
struct coordinate{
int x, y;
coordinate() {}
coordinate(int x, int y) : x(x), y(y) {}
bool operator < (const coordinate &t) const{
if(x == t.x) return y < t.y;
return x < t.x;
}
};
void rotate(vector<coordinate> &v){
int len = v.size();
for(int i = 0; i < len; i++){
int tx = v[i].x, ty = v[i].y;
v[i].x = -ty;
v[i].y = tx;
}
}
bool check(map<coordinate, int> mp, vector<coordinate> &a, int dx, int dy, int &ans, int &tx, int &ty){
int len = a.size(), cnt = 0;
for(int i = 0; i < len; i++) if(mp[{a[i].x+dx, a[i].y+dy}] == 0){
if(cnt) return 0;
// cout << a[i].x << "," << a[i].y << endl;
cnt++; ans = i;
}
else mp[{a[i].x+dx, a[i].y+dy}]++;
for(auto [c, num] : mp) if(num == 1){
tx = c.x-dx; ty = c.y-dy;
return 1;
}
return 1;
}
bool comp(vector<coordinate> &a, vector<coordinate> &b, int &tx, int &ty, int &ans){
int len = a.size(), dx, dy, cnt;
map<coordinate, int> mp;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
for(int i = 0; i < len; i++)
mp[{b[i].x, b[i].y}]++;
dx = b[0].x-a[0].x; dy = b[0].y-a[0].y;
if(check(mp, a, dx, dy, ans, tx, ty)) return 1;
dx = b[1].x-a[0].x; dy = b[1].y-a[0].y;
if(check(mp, a, dx, dy, ans, tx, ty)) return 1;
dx = b[0].x-a[1].x; dy = b[0].y-a[1].y;
return check(mp, a, dx, dy, ans, tx, ty);
}
int main(){
ios :: sync_with_stdio(false);
int h1, w1, h2, w2;
vector<coordinate> a, b;
cin >> h1 >> w1;
for(int i = 0; i < h1; i++){
string str;
cin >> str;
for(int j = 0; j < w1; j++)
if(str[j] == 'o') a.emplace_back(j, i);
}
cin >> h2 >> w2;
for(int i = 0; i < h2; i++){
string str;
cin >> str;
for(int j = 0; j < w2; j++)
if(str[j] == 'o') b.emplace_back(j, i);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
cout << "1 1\n1 1\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
2 3 xox ooo 4 2 ox ox ox ox
output:
1 1 1 1
result:
wrong answer Move-target is not empty