#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;
	swap(arr[0], arr[1]);
	int pos[n];
	for (int i = 0; i < n; i++) {
		pos[arr[i]] = i;
	}
	int tot = 0;
	for (int i = 2; i < n; i++) {
		if (pos[i] != i) {
			p[tot] = i;
			q[tot] = pos[i];
			pos[arr[i]] = pos[i];
			swap(arr[i], arr[pos[i]]);
			pos[i] = i;
			tot++;
			swap(arr[0], arr[1]);
			swap(pos[arr[0]], pos[arr[1]]);
		}
	}
	if (arr[0] != 0) {
		p[tot] = 0;
		q[tot] = 1;
		swap(arr[0], arr[1]);
		tot++;
	}
	else {
		p[tot] = 0;
		q[tot] = 0;
		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... |