제출 #1195149

#제출 시각아이디문제언어결과실행 시간메모리
1195149nikulid정렬하기 (IOI15_sorting)C++20
컴파일 에러
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;
}


컴파일 시 표준 에러 (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++){
      |                    ^