Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define FILE ""
- #define USE_FREOPEN 0
- #define USE_LONG 1
- #define USE_IOSOPT 0
- #if USE_LONG
- typedef long long ll;
- typedef unsigned long long ull;
- #else
- typedef int ll;
- typedef unsigned int ull;
- #endif
- #define pb push_back
- #define mp make_pair
- #define fi first
- #define se second
- #define ins insert
- #define rm erase
- #define rs resize
- #define sz size
- #define hmap unordered_map
- #define hset unordered_set
- #define p(a, b) pair < a, b >
- #define sq(x) ((x) * (x))
- #define elsif(x) else if(x)
- #define skip(x) if(x) continue;
- #define unless(t) if(!(t))
- #define rpunless(t) while(!(t))
- #define rev(a) reverse(a.begin(), a.end())
- #define ord(a) sort(a.begin(), a.end())
- #define stlprint(a) \
- { \
- for(auto __LEVEL_1_STL_ITERATOR = a.begin(); __LEVEL_1_STL_ITERATOR != a.end(); __LEVEL_1_STL_ITERATOR++) \
- { \
- cout << (*__LEVEL_1_STL_ITERATOR) << ' '; \
- } \
- cout << endl; \
- }
- #define die(a) \
- { \
- cout << a << endl; \
- exit(0); \
- }
- using namespace std;
- void sortarr(vector < ll > &a, ll s, ll n)
- {
- if(s >= n)
- return;
- ll minx = s;
- for(int i = s; i < n; i++)
- {
- if(a[minx] > a[i])
- minx = i;
- }
- for(int i = minx; i > s; i--)
- {
- cout << i << ' ' << (i + 1) << endl;
- }
- swap(a[s], a[minx]);
- sortarr(a, s + 1, n);
- }
- int main()
- {
- #if USE_IOSOPT
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- #endif
- #if USE_FREOPEN
- freopen(FILE".in", "r", stdin);
- #endif
- freopen(FILE"S.out", "w", stdout);
- ll n;
- cin >> n;
- vector < ll > a;
- for(int i = 0; i < n; i++)
- {
- ll d;
- cin >> d;
- a.pb(d);
- }
- sortarr(a, 0, a.sz());
- }
Advertisement
Add Comment
Please, Sign In to add comment