# War cakewalk Hackerearth Problem coderinme

##### War cakewalk

Alice and Bob are playing the legendary game of Age of Empires. They are trying extremely hard to be strategic, and smart – but are failing to do so. They’re newbies at the game, and are just learning the parts of the game.

They don’t have an idea about the strength and weaknesses of various units in the game. So, they start creating random unites based on how good cool they look to them. But, that’s a terrible strategy in the battlefield of Age of Empires.

To play a fair game, both Alice and Bob generate the same number of units, N. We’re given two arrays representing the strength of the units of both of their armies. The first array represents Bob’s army, the second one represents Alice’s army.

Now, the fight begins. But, how does one come to know who wins? Simple way actually. Every soldier in either army starts going on a rampage, and starts killing every soldier of the opposite army, which has less strength. The army which destroys the other army wins the war, and wins the game between two newbies. If such a case is not possible, the result will thus be a TIE!

Input:

First line of input contains number of test cases T. Each test case contains three lines. First line contains a single integer N, number of soldiers in army of Bob and Alice. Second line contains N space separated integers which represent the strength of Bob’s army similarly third line contains N space separated integers which represent the strength of Alice’s army.

Output:

For each test case print the result.

Constraints:

1 ≤ T ≤ 5
1 ≤ N ≤ 105
0 ≤ Ai,Bi ≤ 109

```#include <iostream>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--){
long long N;
cin>>N;
long long a, Bob=0, Alice=0;
for(long long i=0; i<N; i++){
cin>>a;
Bob = max(Bob, a);
}
for(long long i=0; i<N; i++){
cin>>a;
Alice = max(Alice, a);
}
if(Bob == Alice)
cout<<"Tie"<<endl;
else if(Bob > Alice)
cout<<"Bob"<<endl;
else
cout<<"Alice"<<endl;
}
return 0;
}```
```#include <iostream>
using namespace std;
int main()
{
int T;
cin>>T;
while(T--){
long long N;
cin>>N;
long long a, Bob=0, Alice=0;
for(long long i=0; i<N; i++){
cin>>a;
Bob = max(Bob, a);
}
for(long long i=0; i<N; i++){
cin>>a;
Alice = max(Alice, a);
}
if(Bob == Alice)
cout<<"Tie"<<endl;
else if(Bob > Alice)
cout<<"Bob"<<endl;
else
cout<<"Alice"<<endl;
}
return 0;
}```

### hasectic

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi