Ada Matrix SOLUTIONS ADAMAT
Culinary expert Ada has a lattice with N lines (numbered 1 through N start to finish) and N sections (numbered 1 through N from left to right) containing all numbers somewhere in the range of 1 and N2 comprehensive. For each substantial I and j, we should indicate the cell in the I-th line and j-th segment by (i,j).
Ada needs to sort the grid in column significant request ― for each legitimate I and j, she needs the cell (i,j) to contain the worth (i−1)⋅N+j.
In one activity, Ada ought to pick a number L and translate the submatrix between lines 1 and L and sections 1 and L (comprehensive). Officially, for every I and j (1≤i,j≤L), the incentive in the cell (i,j) after this activity is equivalent to the incentive in (j,i) before it.
The underlying condition of the network is picked so that it is conceivable to sort it utilizing a limited number of activities (perhaps zero). Locate the most modest number of activities needed to sort the grid.
Information
The primary line of the info contains a solitary whole number T signifying the quantity of experiments. The portrayal of T experiments follows.
The main line of each experiment contains a solitary whole number N.
The following N lines portray the grid. For each substantial I, the I-th of these lines contains N space-isolated whole numbers ― the underlying qualities in cells (i,1),(i,2),… ,(i,N).
Yield
For each experiment, print a solitary line containing one number ― the most modest number of tasks needed to sort the lattice.
Imperatives
4≤N≤64
the aggregate of N2 over all test records doesn’t surpass 3⋅105
Subtasks
Subtask #1 (10 focuses):
T≤50
N=4
Subtask #2 (90 focuses): unique limitations
Model Input
1
4
1 2 9 13
5 6 10 14
3 7 11 15
4 8 12 16
Model Output
2
Clarification
Model case 1: After the main activity, with L=2, the subsequent lattice is
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
After the subsequent activity, with L=3, the network gets arranged
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
LOGIC VIDEO IS REMOVED
When the Solution will be posted??
We understand that everyone needs the solutions. But we can't do anything until our admin approve us. This is a Long Challenge different that 3 hours contest, we need to wait for the approval, if the answers are released this contest will be a waste and it will be resulted as mass cheating. For your help we will like to share a Link please follow that to understand the logic. Or we are deciding to put it on our page itself.
GUYS PLEASE UTILIZE THE TIME TO CODE DON'T PANIC. IF YOU ALL DON'T WANNA CODE THEN JUST CHILL THERE IS NOT HARM IN SUBMITTING ANSWER LATE YOU MARKS WON'T BE REDUCE.
WAIT UNTIL WE SHARE THE CODE OR YOU CAN CODE IN BOTH WAY BENEFIT IS YOURS, KEEP CODING GUYS….
thanks a bunch man
Thanks a bunch man I
100% Working Solution
t=int(input())
while(t>0):
t=t-1
y=int(input())
count = 0;blist=[]
for i in range(y):
blist.append([int(x) for x in input().split()])
for j in range(y-1,0,-1):
mat=blist[j][j-1]+j-1
if mat!=blist[j][j]:
count+=j-1
sol=j+j-1
for i in range(sol):
for k in range(i,sol):
trav=blist[i][k]
blist[i][k]=blist[k][i]
blist[i][k]=trav
print(count)
Thanks man I was doing it the other way lol
Thanks man I was doing it the other way lol
this code is wrong
your code is wrong