Submission #1195149

#TimeUsernameProblemLanguageResultExecution timeMemory
1195149nikulidSorting (IOI15_sorting)C++20
Compilation error
0 ms0 KiB
#include "sorting.h"
#include <vector>
using namespace std;

int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
    // we are given S[], M, X[], Y[]
    // we are to give P[], Q[]
    vector<int> ns;
    for(int i=0; i<N; i++){
    	ns.push_back(S[i]);
    }
    for(int i=0; i<n; i++){
    	P[i] = i;
    	Q[i] = ns[i];
    	swap(ns[i], ns[ns[i]]);
    }
	return 1;
}


Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:12:20: error: 'n' was not declared in this scope
   12 |     for(int i=0; i<n; i++){
      |                    ^