# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
502889 | uncripted | Xor Sort (eJOI20_xorsort) | C++11 | 44 ms | 1356 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |