# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
135281 | StevenH | 정렬하기 (IOI15_sorting) | C++14 | 4 ms | 508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "sorting.h"
#include <algorithm>
#include <cstdlib>
#include <cstdio>
using namespace std;
struct Ele{
int val,id;
}ele[1000];
bool comp(Ele x,Ele y)
{
return x.val<y.val;
}
void swap(int &x ,int &y)
{int t=x; x=y; y=t;}
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].val=S[i],ele[i].id=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(S[j]==ele[i].val)
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++;
}
}
else if (X[0]==0 && Y[0]==1)
{
P[R]=0;
Q[R]=1;
R++;
}
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... |