# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
135283 | StevenH | 정렬하기 (IOI15_sorting) | C++14 | 6 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include <algorithm>
#include <cstdlib>
#include <cstdio>
using namespace std;
int ele[1000];
void swap(int &x ,int &y)
{int t=x; x=y; y=t;}
int comp(int x,int y)
{return x<y;}
int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
P[0] = 0;
Q[0] = 0;
for (int i=0; i<N; i++)
ele[i]=S[i];
sort(ele,ele+N,comp);
int R=0;
for(int i=2; i<N; i++)
{
int j;
for(j=0;j<N;j++)
{
if(j>1 && j<i)
continue;
if(S[j]==ele[i])
break;
}
P[R]=j;
Q[R]=i;
R++;
swap(S[i],S[j]);
}
if(X[0]==0 && Y[0]==0)
{
if(S[0]>S[1])
{
P[R]=0;
Q[R]=1;
R++;
swap(S[0],S[1]);
}
}
else if (X[0]==0 && Y[0]==1)
{
for(int i=0;i<R;i++)swap(S[0],S[1]);
if(S[0]>S[1])
{
P[R]=0;
Q[R]=0;
R++;
swap(S[0],S[0]);
}
}
/*for(int i=0;i<N;i++)printf("%d ",S[i]);
printf("\n");*/
return R;
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |