-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path489A.cpp
More file actions
55 lines (55 loc) · 1.04 KB
/
489A.cpp
File metadata and controls
55 lines (55 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include <string>
#include <streambuf>
#include <fstream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <map>
#include <set>
#include <stdlib.h>
#include <cstdio>
#include <vector>
#include <queue>
#include <math.h>
using namespace std;
long long sum=0;
int a[99999];
int main()
{
int t,n,m,count=0;
vector <int> x,y;
cin >> t;
for(int k=0;k<t;k++)
{
cin >> a[k];
}
int min,choice;
for(int i=0;i<t;i++)
{
min=a[i];
choice=i;
for(int j=i+1;j<t;j++)
{
if(a[j]<min)
{
min=a[j];
choice=j;
}
}
if(choice==i)
continue;
x.push_back(i);
y.push_back(choice);
swap(a[i],a[choice]);
}
cout << x.size() << endl;
for(int i=0;i<x.size();i++)
{
cout << x[i] << " " << y[i] << endl;
}
return 0;
}