#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
int findSwapPairs(int N, int arr[], int m, int x[], int y[], int p[], int q[]) {
int n = N;
int pos[n];
for (int i = 0; i < n; i++) {
pos[arr[i]] = i;
}
int tot = 0;
for (int i = 0; i < n; i++) {
if (pos[i] == i) continue;
p[tot] = i;
q[tot] = pos[i];
pos[arr[i]] = pos[i];
swap(arr[i], arr[pos[i]]);
pos[i] = i;
tot++;
}
return tot;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |