Submission #366304

#TimeUsernameProblemLanguageResultExecution timeMemory
366304model_codeXor Sort (eJOI20_xorsort)Cpython 3
0 / 100
16 ms3052 KiB
N, S = map(int,input().split())
A = list(map(int,input().split()))

operations = []

for i in range(N):
  for j in range(N-i):
    if A[j] > A[j+1]:
      operations.append((j,j+1))
      operations.append((j+1,j))
      operations.append((j,j+1))
      A[j], A[j+1] = A[j+1], A[j]

print(len(operations))
for i, j in operations: print(i+1, j+1)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...