# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
135310 | StevenH | 정렬하기 (IOI15_sorting) | C++14 | 4 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[]) {
for (int i=0; i<N; i++)
ele[i]=S[i];
sort(ele,ele+N,comp);
int R=0;
for(int i=0; i<N; i++)
{
swap(S[0],S[1]);
int j;
if (i==1)j=0;
else j=i;
for(j;j<N;j++)
{
if(i==1 && j==1)continue;
if(S[j]==ele[i])
break;
}
if(i==1)
{
P[R]=0;
Q[R]=j;
R++;
swap(S[0],S[j]);
continue;
}
P[R]=j;
Q[R]=i;
R++;
swap(S[i],S[j]);
}
if (X[0]==0 && Y[0]==1)
{
if(S[0]>S[1])
{
P[R]=0;
Q[R]=0;
R++;
swap(S[0],S[1]);
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... |