Submission #463949

# Submission time Handle Problem Language Result Execution time Memory
463949 2021-08-12T05:04:21 Z amunduzbaev Xor Sort (eJOI20_xorsort) C++14
0 / 100
1 ms 204 KB
#include "bits/stdc++.h"
using namespace std;

void solve(){
	int n, s; cin>>n>>s;
	vector<int> a(n);
	for(auto& x : a) cin>>x;
	
	vector<array<int, 2>> rr;
	auto swwap = [&](int i, int j){
		rr.push_back({i, j});
		rr.push_back({j, i});
		rr.push_back({i, j});
	}; 
	
	for(int i=0;i<n;i++){
		int p = i;
		for(int j=i+1;j<n;j++){
			if(a[j] < a[p]) p = j;
		}
		
		while(p > i){
			swwap(p, p-1);
			p--;
		}
	}
	
	for(auto x : rr) cout<<x[0] + 1<<" "<<x[1] + 1<<"\n";
}

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	//~ cin>>t;
	while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Not adjacent
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Not adjacent
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Not adjacent
2 Halted 0 ms 0 KB -