Submission #434451

# Submission time Handle Problem Language Result Execution time Memory
434451 2021-06-21T10:20:59 Z Azimjon Sorting (IOI15_sorting) C++17
0 / 100
2 ms 332 KB
#include "sorting.h"
#include <bits/stdc++.h>

using namespace std;

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
	int lst = 0;

	vector<int> v;

	v.push_back(1);
	v.push_back(0);
	for (int i = 2; i < N; i++) {
		v.push_back(i);
	}

	for (int i : v) {
		int j = i;
		while (S[j] != i)
			j++;

		if (i == j) continue;

		P[lst] = i;
		Q[lst] = j;

		swap(S[i], S[j]);

		lst++;
	}

	return lst;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:6:39: warning: unused parameter 'M' [-Wunused-parameter]
    6 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                   ~~~~^
sorting.cpp:6:46: warning: unused parameter 'X' [-Wunused-parameter]
    6 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:6:55: warning: unused parameter 'Y' [-Wunused-parameter]
    6 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                                   ~~~~^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 268 KB Integer 1 violates the range [0, 0]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -