0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-24 03:31:59 +00:00
Baoshuo Ren 2021-11-22 17:59:22 +08:00 committed by Baoshuo Ren
parent 59c9801478
commit 6cb4515b21
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

31
CodeForces/1612/A/A.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <bits/stdc++.h>
using namespace std;
int t, x, y, n, xx, yy;
inline int d(int x1, int y1, int x2, int y2) {
return abs(x1 - x2) + abs(y1 - y2);
}
int main() {
cin >> t;
while (t--) {
bool flag = false;
cin >> x >> y;
n = x + y;
for (int i = 0; i * 2 <= n; i++) {
xx = i;
yy = (n >> 1) - i;
if ((x + y) / 2.0 == xx + yy && (x + y) / 2.0 == d(x, y, xx, yy)) {
cout << xx << ' ' << yy << endl;
flag = true;
break;
}
}
if (!flag) {
cout << "-1 -1" << endl;
}
}
return 0;
}