the first line of input consists of number of testcases,T the first line of each testcases consists of number of villains and players ,N the second line of each testcase consists of N space separated by strength of villains the third line of each testcases consists of N space separated by energy of players
Answers
Answer:
Explanation:
The first line of input contains space separated values of N and M. The next N lines contains M space separated integers. Output Format.
Answer:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t,n;
cin>>t;
while(t!=0)
{
cin>>n;
int v[n],p[n];
for(int i=0;i<n;i++)
cin>>v[i];
for(int i=0;i<n;i++)
cin>>p[i];
sort(v,v+ n, greater<int>());
sort(p,p+ n, greater<int>());
int f=0;
for(int i=0;i<n;i++)
{
if(p[i]>v[i])
continue;
else
{
f=1; break;
}
}
if(f==1)
cout<<"LOSE\n";
else
cout<<"WIN\n";
t--;
}
return 0;
}
Explanation:
Sort both the arrays in descending order and compare each element.