Submission #138242

# Submission time Handle Problem Language Result Execution time Memory
138242 2019-07-29T16:06:56 Z MvC Sorting (IOI15_sorting) C++11
0 / 100
4 ms 504 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[]) {
	map<int,int> pos;
    for (int i = 0; i < N; ++i)
    	pos[S[i]]=i;
    int comp=0;
    for (int i = 0; i < N; ++i)
    {
    	P[comp]=pos[i],Q[comp]=i;
    	swap(pos[i],pos[S[i]]);
    	swap(S[P[i]],S[Q[i]]);
    	comp++;
    }
	return comp;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:5:39: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                       ^
sorting.cpp:5:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                ^
sorting.cpp:5:57: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                         ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -