Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
int t,a,b,r;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d %d",&a,&b);
if(b>a){
printf("impossible\n");
}
else{
r=(a+b)/2;
if(r+(a-r) != a || r-(a-r)!=b ){
printf("impossible\n");
}
else{
printf("%d %d\n",r,a-r);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.