답안 #830568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
830568 2023-08-19T08:06:34 Z Shithila 정렬하기 (IOI15_sorting) C++14
컴파일 오류
0 ms 0 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 pos[N];
  for(int i=0;i<N;i++) pos[s[i]]=i;
  for(int i=0;i<N;i++)
  {
      P[i]=i;
      Q[i]=pos[s[i]];
      int x=pos[i];
      pos[i]=i;
      pos[s[i]]=x;
    }
    return n;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:5:11: error: 'N' was not declared in this scope
    5 |   int pos[N];
      |           ^
sorting.cpp:6:24: error: 'pos' was not declared in this scope; did you mean 'pow'?
    6 |   for(int i=0;i<N;i++) pos[s[i]]=i;
      |                        ^~~
      |                        pow
sorting.cpp:10:12: error: 'pos' was not declared in this scope; did you mean 'pow'?
   10 |       Q[i]=pos[s[i]];
      |            ^~~
      |            pow
sorting.cpp:4:39: warning: unused parameter 'M' [-Wunused-parameter]
    4 | int findSwapPairs(int n, int s[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                   ~~~~^
sorting.cpp:4:46: warning: unused parameter 'X' [-Wunused-parameter]
    4 | int findSwapPairs(int n, int s[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:4:55: warning: unused parameter 'Y' [-Wunused-parameter]
    4 | int findSwapPairs(int n, int s[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                                   ~~~~^~~