QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#197547#3525. Move & MeetIsaacMoris#WA 0ms3640kbC++141.1kb2023-10-02 16:58:332023-10-02 16:58:33

Judging History

This is the latest submission verdict.

  • [2023-10-02 16:58:33]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3640kb
  • [2023-10-02 16:58:33]
  • Submitted

answer

#include<iostream>
#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 3e5 + 5, inf = 2e9;


void doWork() {
    ll x1, y1, x2, y2, d1, d2;
    cin >> x1 >> y1 >> d1;
    cin >> x2 >> y2 >> d2;
    ll d3 = abs(x1 - x2) + abs(y1 - y2);
    //cout << d3 << "\n";
    if (d3 <= d1 + d2 && (d1 + d2 - d3) % 2 == 0) {
        ll mx = (x1 + x2) / 2;
        ll my = (y1 + y2) / 2;

        for (ll i = mx - 30; i <= mx + 30; i++) {
            for (ll j = my - 30; j <= my + 30; j++) {
                ll a = abs(x1 - i) + abs(y1 - j), b = abs(x2 - i) + abs(y2 - j);
                if (a <= d1 && b <= d2 && (d1 - a) % 2 == 0 && (d2 - b) % 2 == 0) {
                    cout << i << " " << j;
                    return;
                }
            }
        }
        cout << "impossible\n";
    } else {
        cout << "impossible\n";
    }
}

int main() {
    IO
    int t = 1;
    //   cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

-1 -2 0
1 2 6

output:

-1 -2

result:

ok 

Test #2:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

1 -2 5
-3 3 8

output:

-4 -2

result:

ok 

Test #3:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

0 -1000000000000 0
0 -1000000000000 0

output:

0 -1000000000000

result:

ok 

Test #4:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

-5 -426 932111
83 -870 478692

output:

impossible

result:

ok 

Test #5:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

4 5 6
4 -2 1

output:

4 -1

result:

ok 

Test #6:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

0 0 2
2 2 2

output:

0 2

result:

ok 

Test #7:

score: -100
Wrong Answer
time: 0ms
memory: 3608kb

input:

0 0 1000000000000
5 19923 186

output:

impossible

result:

wrong output format Expected integer, but "impossible" found