QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#197978#3525. Move & MeetGamal74#WA 1ms3720kbC++201.7kb2023-10-02 23:01:032023-10-02 23:01:04

Judging History

This is the latest submission verdict.

  • [2023-10-02 23:01:04]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3720kb
  • [2023-10-02 23:01:03]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

#define fi first
#define se second
#define pp push_back
#define all(x) (x).begin(), (x).end()
#define Ones(n) __builtin_popcount(n)
#define endl '\n'
#define mem(arrr, xx) memset(arrr,xx,sizeof arrr)
//#define int long long
#define debug(x) cout << (#x) << " = " << x << endl

void Gamal() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#ifdef Clion
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
#endif
}

int dx[] = {+0, +0, -1, +1, +1, +1, -1, -1};
int dy[] = {-1, +1, +0, +0, +1, -1, +1, -1};

const double EPS = 1e-9;
const ll OO = 0X3F3F3F3F3F3F3F3F;
const int N = 2e5 + 5, INF = INT_MAX, MOD = 1e9 + 7, LOG = 20;


void solve() {
    ll x1, y1, d1;
    cin >> x1 >> y1 >> d1;
    ll x2, y2, d2;
    cin >> x2 >> y2 >> d2;
    ll dist = abs(x1 - x2) + abs(y1 - y2);
    if (dist > d1 + d2) {
        cout << "impossible";
        return;
    }
    ll go = min(abs(x2-x1),d1);
    x1 += go * (x1 < x2 ? 1:-1);
    d1 -= go;

    go = min(abs(y2-y1),d1);
    y1 += go * (y1 < y2 ? 1:-1);
    d1 -= go;


    go = min(abs(x2-x1),d2);
    x2 += go * (x2 < x1 ? 1:-1);
    d2 -= go;

    go = min(abs(y2-y1),d2);
    y2 += go * (y2 < y1 ? 1:-1);
    d2 -= go;

    if(d1 % 2 != d2 % 2){
        cout << "impossible";
        return;
    }
    assert(x1 == x2 && y1 == y2);
    cout << x1 << ' ' << y1;
}


signed main() {
    Gamal();
    int t = 1;
//    cin >> t;
    while (t--) {
        solve();
    }
}

详细

Test #1:

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

input:

-1 -2 0
1 2 6

output:

-1 -2

result:

ok 

Test #2:

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

input:

1 -2 5
-3 3 8

output:

-3 -1

result:

ok 

Test #3:

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

input:

0 -1000000000000 0
0 -1000000000000 0

output:

0 -1000000000000

result:

ok 

Test #4:

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

input:

-5 -426 932111
83 -870 478692

output:

impossible

result:

ok 

Test #5:

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

input:

4 5 6
4 -2 1

output:

4 -1

result:

ok 

Test #6:

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

input:

0 0 2
2 2 2

output:

2 0

result:

ok 

Test #7:

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

input:

0 0 1000000000000
5 19923 186

output:

5 19923

result:

ok 

Test #8:

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

input:

-237700907237 445576550446 594610055595
681973265681 -171560526172 843757392844

output:

impossible

result:

ok 

Test #9:

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

input:

-537351556538 -807721987807 690465417691
287415372288 977794499977 17905823179

output:

impossible

result:

ok 

Test #10:

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

input:

30 40 100000
-120 1 100

output:

impossible

result:

ok 

Test #11:

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

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:

70100797810 257224740065

result:

ok 

Test #13:

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

input:

387193259973 268407387361 274058113004
486675093266 437040007372 635497639980

output:

486675093266 437040007372

result:

ok 

Test #14:

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

input:

-66320811801 919108842699 157508694485
-80000538110 914988414819 82749433617

output:

impossible

result:

ok 

Test #15:

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

input:

765386284887 767515994322 844612298930
-497093441686 743109429921 768922899446

output:

-79226014043 767515994322

result:

ok 

Test #16:

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

input:

576684618279 101148508605 965690689741
223791260345 -615434796187 201910224082

output:

impossible

result:

ok 

Test #17:

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

input:

607440915555 -437703752649 654737937086
917936905179 -135927848060 807123864242

output:

impossible

result:

ok 

Test #18:

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

input:

549382762652 -122436732168 729685198193
705070160054 -280825314671 720490842890

output:

705070160054 -280825314671

result:

ok 

Test #19:

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

input:

672839055467 -111222333444 0
672839055467 -111222333444 555555555555

output:

impossible

result:

ok 

Test #20:

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

input:

100 100 900000000000
100 900000000100 10000000000

output:

100 900000000100

result:

ok 

Test #21:

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

input:

1000 1000 3333
4333 1000 6666

output:

4333 1000

result:

ok 

Test #22:

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

input:

12 111111111333 222222222222
12 333333333555 222222222222

output:

12 333333333555

result:

ok 

Test #23:

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

input:

0 0 10
5 5 10

output:

5 5

result:

ok 

Test #24:

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

input:

-2523498 -3458345 10851720
2525555 2344321 10851719

output:

2525555 2344321

result:

wrong answer WA: bad coordinates