How to reaarange the second array to get that…maximum number of elemnets in the first array is greater than the element of second array @everule1
My code is:
from itertools import permutations
for _ in range(int(input())):
n=int(input())
team_g=list(map(int,input().split()))
other=list(map(int,input().split()))
ma=0
for prem in permutations(other):
count=0
for j in range(len(prem)):
if prem[j]<team_g[j]:
count+=1
ma=max(ma,count)
if(ma==n):
break
print(ma)
The problem is, the data is present randomly and not in the order they have to fight the opponent. Team G-Revolution wants to win at any cost and for that, they need the order in which they have to fight optimally to win the maximum number of battles.
A player can win only when his/her beyblade power is strictly greater than the opponents beyblade power.
One of the comments has a link to the competetive programming handbook pdf. Read the full thing, and try questions again. Its only 300 pages. It’s okay if you don’t understand it. Just read the full thing. As you do questions, they’ll remind you of some topic in the book, then reread that part.