답안 #1076723

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1076723 2024-08-26T15:53:37 Z LCJLY 정렬하기 (IOI15_sorting) C++14
0 / 100
1 ms 604 KB
#include "sorting.h"
#include <bits/stdc++.h>
//#include "grader.cpp"
using namespace std;

#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    int arr[N];
    int pos[N];
    for(int x=0;x<N;x++){
		arr[x]=x;
		pos[arr[x]]=x;
	}
	
	for(int x=0;x<M;x++){
		swap(arr[pos[X[x]]],arr[pos[Y[x]]]);
		swap(pos[X[x]],pos[Y[x]]);
	}
	
	for(int x=0;x<N;x++){
		P[x]=arr[x];
		Q[x]=S[x];
	}
	return M;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 604 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -