In this HackerEarth A chessboard problem solution In this version of chess, only two kings pieces are placed on the chessboard. Initially, the coordinates of the first king piece are generated (X1, Y1), it is placed on the chessboard at the generated position. Now, the coordinates of the second king piece are generated (X2, Y2), it is placed on the chessboard at the generated position.

These pieces can be moved in a sequential manner, that is, one by one, starting from the first piece. Both the kings want to win if they can not, at least draw.


HackerEarth A chessboard problem solution


HackerEarth A chessboard problem solution.

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define endl "\n"
#define test ll txtc; cin>>txtc; while(txtc--)
typedef long long int ll;
typedef long double ld;
int main() {
FIO;
test
{
ll x1,y1; cin>>x1>>y1;
ll x2,y2; cin>>x2>>y2;
if(x1==x2 && y1==y2){
cout<<"SECOND";
}
else if(abs(x1-x2)<=1 && abs(y1-y2)<=1){
cout<<"FIRST";
}
else{
cout<<"DRAW";
}
cout<<endl;
}
return 0;
}

Second solution

t = int(input())
while t > 0:
t -= 1
[x1, y1] = map(int, input().split())
[x2, y2] = map(int, input().split())
print("SECOND" if abs(x1 - x2) <= 0 and abs(y1 - y2) <= 0 else "FIRST" if abs(x1 - x2) <= 1 and abs(