답안 #502889

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
502889 2022-01-06T17:32:16 Z uncripted Xor Sort (eJOI20_xorsort) C++11
25 / 100
44 ms 1356 KB
#include<bits/stdc++.h>
using namespace std;
	int pas[40000][3];
int main(){
	int s;
	int n;	
	cin>>n;
	cin>>s;

	int k=0;
	int a[n+1];
	for(int i=1; i<=n; i++){
		cin>>a[i];

	}

	
		int j=0;
		for(int i=0; i<n-1; i++){
			for(int j=n; j>i+1; j--){
				if(j==1){
					continue;
				}
				if(a[j]>=a[j-1]){
					continue;
				}
				pas[k+1][1]=j;
				pas[k+1][2]=j-1;
				pas[k+2][1]=j-1;
				pas[k+2][2]=j;
				pas[k+3][1]=j;
				pas[k+3][2]=j-1;
				k+=3;
			//	cout<<a[j]<<"x "<<j-1<<endl;
				swap(a[j], a[j-1]);
			}
		}
	
	
		
	

	cout<<k<<endl;
	for(int i=1; i<=k; i++){
		cout<<pas[i][1]<<" "<<pas[i][2]<<endl;
	}

	
}

Compilation message

xorsort.cpp: In function 'int main()':
xorsort.cpp:18:7: warning: unused variable 'j' [-Wunused-variable]
   18 |   int j=0;
      |       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 18 ms 460 KB Output is correct
5 Correct 22 ms 552 KB Output is correct
6 Correct 21 ms 588 KB Output is correct
7 Correct 21 ms 576 KB Output is correct
8 Correct 23 ms 588 KB Output is correct
9 Correct 23 ms 600 KB Output is correct
10 Correct 23 ms 588 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 43 ms 800 KB Output is correct
13 Correct 42 ms 916 KB Output is correct
14 Correct 44 ms 892 KB Output is correct
15 Correct 44 ms 936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 18 ms 460 KB Output is correct
5 Correct 22 ms 552 KB Output is correct
6 Correct 21 ms 588 KB Output is correct
7 Correct 21 ms 576 KB Output is correct
8 Correct 23 ms 588 KB Output is correct
9 Correct 23 ms 600 KB Output is correct
10 Correct 23 ms 588 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 43 ms 800 KB Output is correct
13 Correct 42 ms 916 KB Output is correct
14 Correct 44 ms 892 KB Output is correct
15 Correct 44 ms 936 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 22 ms 556 KB Output is correct
18 Correct 38 ms 828 KB Output is correct
19 Correct 44 ms 880 KB Output is correct
20 Correct 38 ms 716 KB Output is correct
21 Correct 36 ms 836 KB Output is correct
22 Correct 39 ms 792 KB Output is correct
23 Correct 39 ms 844 KB Output is correct
24 Correct 37 ms 828 KB Output is correct
25 Correct 39 ms 812 KB Output is correct
26 Runtime error 2 ms 1356 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 37 ms 824 KB Output is correct
5 Runtime error 1 ms 1356 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -