QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#60994 | #3525. Move & Meet | Sa3tElSefr# | WA | 3ms | 3424kb | C++23 | 2.2kb | 2022-11-09 01:06:24 | 2022-11-09 01:06:27 |
Judging History
answer
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
// #pragma GCC optimize("O3")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("avx,avx2,fma")
using namespace std;
#define ll long long
#define ld long double
typedef complex<ld> point;
#define polar(r, t) ((r)*exp(point(0, (t))))
#define length(a) (hypot((a).imag(), (a).real()))
#define rotate(v, t) (polar(v, t))
#define X real()
#define Y imag()
#define cp(a, b) ((conj(a) * (b)).imag())
#define EPS 1e-13
// #define M_PI acosl(-1.0l)
const int N = 1e6 + 5, lg = 19, mod = 998244353;
const int M = 1e7 + 5;
const int INF = 1e9;
ll x[2], y[2], d[2];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
for (int i = 0; i < 2; ++i) {
cin >> x[i] >> y[i] >> d[i];
}
ll dist = abs(x[0] - x[1]) + abs(y[0] - y[1]);
if (d[0] + d[1] < dist || (d[0] + d[1] - dist) & 1) {
cout << "impossible\n";
} else {
ll meet_x = x[0];
int sign = (x[1] > x[0] ? 1 : -1);
ll moves = min(abs(x[0] - x[1]), d[0]);
meet_x += sign * moves;
d[0] -= moves;
ll meet_y = y[0];
sign = (y[1] > y[0] ? 1 : -1);
moves = min(abs(y[0] - y[1]), d[0]);
meet_y += sign * moves;
cout << meet_x << ' ' << meet_y << '\n';
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 3300kb
input:
-1 -2 0 1 2 6
output:
-1 -2
result:
ok
Test #2:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
1 -2 5 -3 3 8
output:
-3 -1
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 3236kb
input:
0 -1000000000000 0 0 -1000000000000 0
output:
0 -1000000000000
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
-5 -426 932111 83 -870 478692
output:
impossible
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 3336kb
input:
4 5 6 4 -2 1
output:
4 -1
result:
ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 3324kb
input:
0 0 2 2 2 2
output:
2 0
result:
ok
Test #7:
score: 0
Accepted
time: 1ms
memory: 3292kb
input:
0 0 1000000000000 5 19923 186
output:
5 19923
result:
ok
Test #8:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
-237700907237 445576550446 594610055595 681973265681 -171560526172 843757392844
output:
impossible
result:
ok
Test #9:
score: 0
Accepted
time: 2ms
memory: 3248kb
input:
-537351556538 -807721987807 690465417691 287415372288 977794499977 17905823179
output:
impossible
result:
ok
Test #10:
score: 0
Accepted
time: 2ms
memory: 3304kb
input:
30 40 100000 -120 1 100
output:
impossible
result:
ok
Test #11:
score: 0
Accepted
time: 2ms
memory: 3340kb
input:
267127854709 343405973674 26161892148 381294549365 370274347369 145141827064
output:
impossible
result:
ok
Test #12:
score: 0
Accepted
time: 2ms
memory: 3424kb
input:
-31878165543 682414817093 568347503685 70100797810 257224740065 112811330402
output:
70100797810 257224740065
result:
ok
Test #13:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
387193259973 268407387361 274058113004 486675093266 437040007372 635497639980
output:
486675093266 437040007372
result:
ok
Test #14:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
-66320811801 919108842699 157508694485 -80000538110 914988414819 82749433617
output:
impossible
result:
ok
Test #15:
score: 0
Accepted
time: 2ms
memory: 3304kb
input:
765386284887 767515994322 844612298930 -497093441686 743109429921 768922899446
output:
-79226014043 767515994322
result:
ok
Test #16:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
576684618279 101148508605 965690689741 223791260345 -615434796187 201910224082
output:
impossible
result:
ok
Test #17:
score: 0
Accepted
time: 3ms
memory: 3340kb
input:
607440915555 -437703752649 654737937086 917936905179 -135927848060 807123864242
output:
impossible
result:
ok
Test #18:
score: 0
Accepted
time: 0ms
memory: 3296kb
input:
549382762652 -122436732168 729685198193 705070160054 -280825314671 720490842890
output:
705070160054 -280825314671
result:
ok
Test #19:
score: 0
Accepted
time: 2ms
memory: 3240kb
input:
672839055467 -111222333444 0 672839055467 -111222333444 555555555555
output:
impossible
result:
ok
Test #20:
score: 0
Accepted
time: 2ms
memory: 3300kb
input:
100 100 900000000000 100 900000000100 10000000000
output:
100 900000000100
result:
ok
Test #21:
score: 0
Accepted
time: 2ms
memory: 3236kb
input:
1000 1000 3333 4333 1000 6666
output:
4333 1000
result:
ok
Test #22:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
12 111111111333 222222222222 12 333333333555 222222222222
output:
12 333333333555
result:
ok
Test #23:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
0 0 10 5 5 10
output:
5 5
result:
ok
Test #24:
score: -100
Wrong Answer
time: 0ms
memory: 3328kb
input:
-2523498 -3458345 10851720 2525555 2344321 10851719
output:
2525555 2344321
result:
wrong answer WA: bad coordinates