답안 #463954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
463954 2021-08-12T05:12:12 Z amunduzbaev Xor Sort (eJOI20_xorsort) C++14
25 / 100
148 ms 12436 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){
		rr.push_back({i + 1, i});
		rr.push_back({i, i + 1});
		rr.push_back({i + 1, i});
	}; 
	
	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){
			swap(a[p], a[p - 1]);
			swwap(p);
			p--;
		}
	}
	
	cout<<(int)rr.size()<<"\n";
	for(auto x : rr) cout<<x[0]<<" "<<x[1]<<"\n";
}

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int t = 1;
	//~ cin>>t;
	while(t--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 4 ms 592 KB Output is correct
6 Correct 4 ms 592 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 4 ms 592 KB Output is correct
9 Correct 4 ms 680 KB Output is correct
10 Correct 4 ms 592 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 10 ms 848 KB Output is correct
13 Correct 7 ms 848 KB Output is correct
14 Correct 7 ms 848 KB Output is correct
15 Correct 8 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 4 ms 588 KB Output is correct
5 Correct 4 ms 592 KB Output is correct
6 Correct 4 ms 592 KB Output is correct
7 Correct 4 ms 592 KB Output is correct
8 Correct 4 ms 592 KB Output is correct
9 Correct 4 ms 680 KB Output is correct
10 Correct 4 ms 592 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 10 ms 848 KB Output is correct
13 Correct 7 ms 848 KB Output is correct
14 Correct 7 ms 848 KB Output is correct
15 Correct 8 ms 848 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 4 ms 592 KB Output is correct
18 Correct 7 ms 848 KB Output is correct
19 Correct 6 ms 848 KB Output is correct
20 Correct 6 ms 852 KB Output is correct
21 Correct 6 ms 848 KB Output is correct
22 Correct 6 ms 848 KB Output is correct
23 Correct 6 ms 848 KB Output is correct
24 Correct 6 ms 848 KB Output is correct
25 Correct 6 ms 848 KB Output is correct
26 Incorrect 12 ms 1320 KB Integer 59568 violates the range [0, 40000]
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 6 ms 848 KB Output is correct
5 Incorrect 148 ms 12436 KB Integer 764742 violates the range [0, 40000]
6 Halted 0 ms 0 KB -