답안 #1018781

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018781 2024-07-10T09:44:18 Z parsadox2 정렬하기 (IOI15_sorting) C++17
36 / 100
8 ms 592 KB
#include "sorting.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 2e3 + 10;
int n , ar[N] , pos[N] , m;

int findSwapPairs(int nn, int S[], int mm, int X[], int Y[], int P[], int Q[]) {
	n = nn;
	m = mm;
	for(int i = 0 ; i < n ; i++)
		ar[i] = S[i];
	int R = 0;
	for(int i = 0 ; i < m ; i++)
	{
		R = i + 1;
		P[i] = Q[i] = 0;
		swap(ar[X[i]] , ar[Y[i]]);
		for(int j = 0 ; j < n ; j++)
			pos[ar[j]] = j;
		bool flg = false;
		for(int j = 2 ; j < n ; j++)  if(pos[j] != j)
		{
			swap(ar[j] , ar[pos[j]]);
			P[i] = j;
			Q[i] = pos[j];
			flg = true;
			break;
		}
		if(flg)
			continue;
		if(pos[0] != 0)
			Q[i] = 1;
		break;
	}
	return R;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 8 ms 592 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -