QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#198421#3525. Move & MeetAnwar#WA 0ms3828kbC++20967b2023-10-03 13:46:402023-10-03 13:46:40

Judging History

This is the latest submission verdict.

  • [2023-10-03 13:46:40]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3828kb
  • [2023-10-03 13:46:40]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = 1e5 + 3, MOD = 998244353;//1e9 + 7;

int32_t main() {

    cin.tie(0);cin.sync_with_stdio(0);
    cout.tie(0);cout.sync_with_stdio(0);

    vector<vector<ll> > a(2 , vector<ll> (3)) ;

    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 3; ++j) {
            cin >> a[i][j] ;
        }
    }

    ll dis = abs(a[0][0] - a[1][0]) + abs( a[0][1] - a[1][1] ) ;

    if(dis > a[0][2] + a[1][2] || dis%2 != (a[0][2] + a[1][2])%2  ) return cout << "impossible" , 0 ;

    if(a[0][2] > a[1][2]) swap(a[1],  a[0]) ;

    dis = a[0][2] ;

    int x ;
    if(a[1][0] > a[0][0]) x = min( a[1][0] , a[0][0] + dis ) ;
    else x = max( a[1][0] , a[0][0] - dis ) ;

    dis -= abs(x - a[0][0]);

    if(a[1][1] > a[0][1]) cout << x << " " << min(a[1][1] , a[0][1] + dis) ;
    else cout << x << " " << max(a[1][1] , a[0][1] - dis) ;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

-1 -2 0
1 2 6

output:

-1 -2

result:

ok 

Test #2:

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

input:

1 -2 5
-3 3 8

output:

-3 -1

result:

ok 

Test #3:

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

input:

0 -1000000000000 0
0 -1000000000000 0

output:

0 -1000000000000

result:

ok 

Test #4:

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

input:

-5 -426 932111
83 -870 478692

output:

impossible

result:

ok 

Test #5:

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

input:

4 5 6
4 -2 1

output:

4 -1

result:

ok 

Test #6:

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

input:

0 0 2
2 2 2

output:

2 0

result:

ok 

Test #7:

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

input:

0 0 1000000000000
5 19923 186

output:

0 19742

result:

ok 

Test #8:

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

input:

-237700907237 445576550446 594610055595
681973265681 -171560526172 843757392844

output:

impossible

result:

ok 

Test #9:

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

input:

-537351556538 -807721987807 690465417691
287415372288 977794499977 17905823179

output:

impossible

result:

ok 

Test #10:

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

input:

30 40 100000
-120 1 100

output:

impossible

result:

ok 

Test #11:

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

input:

267127854709 343405973674 26161892148
381294549365 370274347369 145141827064

output:

impossible

result:

ok 

Test #12:

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

input:

-31878165543 682414817093 568347503685
70100797810 257224740065 112811330402

output:

-1813394471 298121878186

result:

ok 

Test #13:

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

input:

387193259973 268407387361 274058113004
486675093266 437040007372 635497639980

output:

1343788818 156616029210

result:

wrong answer WA: bad coordinates