QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#225115#3525. Move & Meetgondozu#WA 1ms3340kbC++141.3kb2023-10-23 23:49:232023-10-23 23:49:23

Judging History

This is the latest submission verdict.

  • [2023-10-23 23:49:23]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3340kb
  • [2023-10-23 23:49:23]
  • Submitted

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