QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#70781 | #3525. Move & Meet | juwkim | WA | 17ms | 8288kb | Python3 | 634b | 2023-01-07 22:45:15 | 2023-01-09 01:25:20 |
Judging History
answer
def move(p, q, d):
dmove = min(abs(p - q), d)
return p + [-dmove, dmove][q > p], d - dmove
def solve22():
x1, y1, d1 = map(int, input().split())
x2, y2, d2 = map(int, input().split())
dist = abs(x1 - x2) + abs(y1 - y2)
if dist > d1 + d2:
return 'impossible'
x1, d1 = move(x1, x2, d1)
y1, d1 = move(y1, y2, d1)
x2, d2 = move(x2, x1, d2)
y2, d2 = move(y2, y1, d2)
r1, r2 = d1 & 1, d2 & 1
if r1 != r2:
return 'impossible'
return x1 + r1, y1 + r1
ans = solve22()
if ans == 'impossible':
print(ans)
else:
print(*ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 8168kb
input:
-1 -2 0 1 2 6
output:
-1 -2
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 8092kb
input:
1 -2 5 -3 3 8
output:
-3 -1
result:
ok
Test #3:
score: 0
Accepted
time: 11ms
memory: 8160kb
input:
0 -1000000000000 0 0 -1000000000000 0
output:
0 -1000000000000
result:
ok
Test #4:
score: 0
Accepted
time: 11ms
memory: 8156kb
input:
-5 -426 932111 83 -870 478692
output:
impossible
result:
ok
Test #5:
score: 0
Accepted
time: 9ms
memory: 8140kb
input:
4 5 6 4 -2 1
output:
4 -1
result:
ok
Test #6:
score: 0
Accepted
time: 17ms
memory: 8280kb
input:
0 0 2 2 2 2
output:
2 0
result:
ok
Test #7:
score: 0
Accepted
time: 11ms
memory: 8056kb
input:
0 0 1000000000000 5 19923 186
output:
5 19923
result:
ok
Test #8:
score: 0
Accepted
time: 7ms
memory: 8108kb
input:
-237700907237 445576550446 594610055595 681973265681 -171560526172 843757392844
output:
impossible
result:
ok
Test #9:
score: 0
Accepted
time: 12ms
memory: 8176kb
input:
-537351556538 -807721987807 690465417691 287415372288 977794499977 17905823179
output:
impossible
result:
ok
Test #10:
score: 0
Accepted
time: 9ms
memory: 8288kb
input:
30 40 100000 -120 1 100
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 14ms
memory: 8156kb
input:
267127854709 343405973674 26161892148 381294549365 370274347369 145141827064
output:
impossible
result:
ok
Test #12:
score: 0
Accepted
time: 5ms
memory: 8184kb
input:
-31878165543 682414817093 568347503685 70100797810 257224740065 112811330402
output:
70100797810 257224740065
result:
ok
Test #13:
score: 0
Accepted
time: 2ms
memory: 8152kb
input:
387193259973 268407387361 274058113004 486675093266 437040007372 635497639980
output:
486675093266 437040007372
result:
ok
Test #14:
score: 0
Accepted
time: 16ms
memory: 8184kb
input:
-66320811801 919108842699 157508694485 -80000538110 914988414819 82749433617
output:
impossible
result:
ok
Test #15:
score: 0
Accepted
time: 4ms
memory: 8216kb
input:
765386284887 767515994322 844612298930 -497093441686 743109429921 768922899446
output:
-79226014043 767515994322
result:
ok
Test #16:
score: 0
Accepted
time: 6ms
memory: 8160kb
input:
576684618279 101148508605 965690689741 223791260345 -615434796187 201910224082
output:
impossible
result:
ok
Test #17:
score: 0
Accepted
time: 3ms
memory: 8080kb
input:
607440915555 -437703752649 654737937086 917936905179 -135927848060 807123864242
output:
impossible
result:
ok
Test #18:
score: 0
Accepted
time: 12ms
memory: 8152kb
input:
549382762652 -122436732168 729685198193 705070160054 -280825314671 720490842890
output:
705070160054 -280825314671
result:
ok
Test #19:
score: 0
Accepted
time: 14ms
memory: 8224kb
input:
672839055467 -111222333444 0 672839055467 -111222333444 555555555555
output:
impossible
result:
ok
Test #20:
score: 0
Accepted
time: 7ms
memory: 8168kb
input:
100 100 900000000000 100 900000000100 10000000000
output:
100 900000000100
result:
ok
Test #21:
score: 0
Accepted
time: 16ms
memory: 8156kb
input:
1000 1000 3333 4333 1000 6666
output:
4333 1000
result:
ok
Test #22:
score: 0
Accepted
time: 11ms
memory: 8284kb
input:
12 111111111333 222222222222 12 333333333555 222222222222
output:
12 333333333555
result:
ok
Test #23:
score: 0
Accepted
time: 5ms
memory: 8168kb
input:
0 0 10 5 5 10
output:
5 5
result:
ok
Test #24:
score: -100
Wrong Answer
time: 13ms
memory: 8220kb
input:
-2523498 -3458345 10851720 2525555 2344321 10851719
output:
2525556 2344322
result:
wrong answer WA: bad coordinates