QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197852 | #3525. Move & Meet | beshoyhany# | WA | 0ms | 3468kb | C++20 | 2.5kb | 2023-10-02 20:55:39 | 2023-10-02 20:55:39 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define pp push_back
#define endl '\n'
#define all(x) x.begin(),x.end()
#define ld long double
#define PI acos(-1)
#define sin(a) sin((a)*PI/180)
#define cos(a) cos((a)*PI/180)
#define ones(x) __builtin_popcountll(x)
//#define int ll
using namespace std;
void Drakon() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef Clion
freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
}
unsigned long long inf = 1e10;
const double EPS = 1e-6;
const int MOD = 1000000007, N = 200005, LOG = 25;
ll gcd(ll x, ll y) {
return y ? gcd(y, x % y) : x;
}
ll lcm(ll a, ll b) {
return (a * b) / __gcd(a, b);
}
ll mul(const ll &a, const ll &b) {
return (a % MOD + MOD) * (b % MOD + MOD) % MOD;
}
ll add(const ll &a, const ll &b) {
return (a + b + 2 * MOD) % MOD;
}
ll pw(ll x, ll y) {
ll ret = 1;
while (y > 0) {
if (y % 2 == 0) {
x = mul(x, x);
y = y / 2;
} else {
ret = mul(ret, x);
y = y - 1;
}
}
return ret;
}
int dir[8][2] = {{0, 1},//right
{0, -1},//left
{1, 0},//down
{-1, 0},//up
{1, 1},
{1, -1},
{-1, 1},
{-1, -1}};
void solve() {
vector<ll>x(2), y(2), d(2), p(2);
for (int i = 0; i < 2; ++i) {
cin >> x[i] >> y[i] >> d[i];
p[i] = x[i] + y[i] + d[i];
p[i] %= 2;
}
if(p[0] != p[1]){
cout << "impossible";
return;
}
for (int i = 0; i < 4; ++i) {
ll nx = x[0] + dir[i][0] * d[0], ny = y[0] + dir[i][1] * d[0];
bool flag = true;
for (int j = 0; j < 2; ++j) {
if(abs(x[i] - nx) + abs(y[i] - ny) > d[i]){
flag = false;
break;
}
}
if(flag){
cout << nx << " " << ny;
return;
}
nx = x[1] + dir[i][0] * d[1], ny = y[1] + dir[i][1] * d[1];
flag = true;
for (int j = 0; j < 2; ++j) {
if(abs(x[i] - nx) + abs(y[i] - ny) > d[i]){
flag = false;
break;
}
}
if(flag){
cout << nx << " " << ny;
return;
}
}
cout << "impossible";
}
signed main() {
Drakon();
int t = 1;
//cin >> t;
while (t--) {
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3468kb
input:
-1 -2 0 1 2 6
output:
impossible
result:
wrong output format Expected integer, but "impossible" found