답안 #830667

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
830667 2023-08-19T09:04:59 Z Supersonic 정렬하기 (IOI15_sorting) C++14
0 / 100
1 ms 340 KB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
int l[200001];
int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
    for(int i=0;i<n;i++)l[s[i]]=i;
	if(m%2==1){
		int a=l[0];
		int b=l[1];
		l[s[a]]=b;l[s[b]]=a;
		swap(s[a],s[b]);
	}
	int c=0;
	for(int i=0;i<n;i++){
		if(l[i]==i)continue;
		int a=l[i];
		int b=i;
		l[s[a]]=b;l[s[b]]=a;
		swap(s[a],s[b]);
		p[c]=a;q[c]=b;
        c++;
	}
	return c;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:5:46: warning: unused parameter 'x' [-Wunused-parameter]
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                          ~~~~^~~
sorting.cpp:5:55: warning: unused parameter 'y' [-Wunused-parameter]
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                                   ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -