QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#225115 | #3525. Move & Meet | gondozu# | WA | 1ms | 3340kb | C++14 | 1.3kb | 2023-10-23 23:49:23 | 2023-10-23 23:49:23 |
Judging History
answer
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define Gondozu ios::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<int>;
using vpi = vector <pair<int, int>>;
using vvi = vector <vector<int>>;
const int OO = 1e9 + 5;
const int N = 1000 + 5;
void TC()
{
ll x1,y1,d1,x2,y2,d2;
cin >> x1 >> y1 >> d1 >> x2 >> y2 >> d2;
ll tot = abs(x1-x2) + abs(y1-y2);
if(d1+d2 < tot || (d1+d2)%2 != tot%2)
return void(cout << "impossible");
ll x = x1,y = y1;
if(x1 < x2)
x += min(d1, x2-x1);
else
x -= min(d1, x1-x2);
d1 -= abs(x1-x2);
if(abs(y1-y2) >= d1){
if(y2 > y1)
y += d1;
else
y -= d1;
} else {
ll dist = abs(y1-y2);
if(d1%2 != abs(y1-y2)%2) dist++;
if(y2 > y1) y += dist;
else y -= dist;
}
cout << x << ' ' << y;
}
int32_t main() {
#ifndef ONLINE_JUDGE
freopen("input.in", "r", stdin); freopen("output.out", "w", stdout);
#endif
Gondozu
int t = 1;
// cin >> t;
while (t--) {
TC();
cout << '\n';
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3340kb
input:
-1 -2 0 1 2 6
output:
-1 -4
result:
wrong answer WA: bad coordinates