QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#197761#3525. Move & MeetMahmoudAtia#WA 0ms3692kbC++14813b2023-10-02 19:35:202023-10-02 19:35:21

Judging History

This is the latest submission verdict.

  • [2023-10-02 19:35:21]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3692kb
  • [2023-10-02 19:35:20]
  • Submitted

answer

#include <bits/stdc++.h>

typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};

const ll oo = 1e18;
const int N = 2e5 + 5, M = 1e5 + 5, MOD = 998244353;
#define EPS 1e-9

ll n, m, k, x[2], y[2], d[2];

int main() {
    //  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    for (int i = 0; i < 2; i++) cin >> x[i] >> y[i] >> d[i];
    ll dx = abs(x[1] - x[0]), dy = abs(y[1] - y[0]), dis = d[0] + d[1];
    if ((dx + dy) > dis || (dis - (dx + dy)) & 1) return !(cout << "impossible");
    ll mn = min({dx, d[0]});
    x[0] += mn * (x[1] > x[0] ? 1 : -1);
    d[0] -= mn;
    mn = min({dy, d[0]});
    y[0] += mn * (y[1] > y[0] ? 1 : -1);
    cout << x[0] << " " << y[0];
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

-1 -2 0
1 2 6

output:

-1 -2

result:

ok 

Test #2:

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

input:

1 -2 5
-3 3 8

output:

-3 -1

result:

ok 

Test #3:

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

input:

0 -1000000000000 0
0 -1000000000000 0

output:

0 -1000000000000

result:

ok 

Test #4:

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

input:

-5 -426 932111
83 -870 478692

output:

impossible

result:

ok 

Test #5:

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

input:

4 5 6
4 -2 1

output:

4 -1

result:

ok 

Test #6:

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

input:

0 0 2
2 2 2

output:

2 0

result:

ok 

Test #7:

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

input:

0 0 1000000000000
5 19923 186

output:

5 19923

result:

ok 

Test #8:

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

input:

-237700907237 445576550446 594610055595
681973265681 -171560526172 843757392844

output:

impossible

result:

ok 

Test #9:

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

input:

-537351556538 -807721987807 690465417691
287415372288 977794499977 17905823179

output:

impossible

result:

ok 

Test #10:

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

input:

30 40 100000
-120 1 100

output:

impossible

result:

ok 

Test #11:

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

input:

267127854709 343405973674 26161892148
381294549365 370274347369 145141827064

output:

impossible

result:

ok 

Test #12:

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

input:

-31878165543 682414817093 568347503685
70100797810 257224740065 112811330402

output:

70100797810 257224740065

result:

ok 

Test #13:

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

input:

387193259973 268407387361 274058113004
486675093266 437040007372 635497639980

output:

486675093266 437040007372

result:

ok 

Test #14:

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

input:

-66320811801 919108842699 157508694485
-80000538110 914988414819 82749433617

output:

impossible

result:

ok 

Test #15:

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

input:

765386284887 767515994322 844612298930
-497093441686 743109429921 768922899446

output:

-79226014043 767515994322

result:

ok 

Test #16:

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

input:

576684618279 101148508605 965690689741
223791260345 -615434796187 201910224082

output:

impossible

result:

ok 

Test #17:

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

input:

607440915555 -437703752649 654737937086
917936905179 -135927848060 807123864242

output:

impossible

result:

ok 

Test #18:

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

input:

549382762652 -122436732168 729685198193
705070160054 -280825314671 720490842890

output:

705070160054 -280825314671

result:

ok 

Test #19:

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

input:

672839055467 -111222333444 0
672839055467 -111222333444 555555555555

output:

impossible

result:

ok 

Test #20:

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

input:

100 100 900000000000
100 900000000100 10000000000

output:

100 900000000100

result:

ok 

Test #21:

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

input:

1000 1000 3333
4333 1000 6666

output:

4333 1000

result:

ok 

Test #22:

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

input:

12 111111111333 222222222222
12 333333333555 222222222222

output:

12 333333333555

result:

ok 

Test #23:

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

input:

0 0 10
5 5 10

output:

5 5

result:

ok 

Test #24:

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

input:

-2523498 -3458345 10851720
2525555 2344321 10851719

output:

2525555 2344321

result:

wrong answer WA: bad coordinates