답안 #830565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
830565 2023-08-19T08:05:33 Z Shithila 정렬하기 (IOI15_sorting) C++14
컴파일 오류
0 ms 0 KB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace
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:4:1: error: expected identifier before 'int'
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      | ^~~
sorting.cpp:3:16: error: expected ';' before 'int'
    3 | using namespace
      |                ^
      |                ;
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      | ~~~             
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:6:28: error: 's' was not declared in this scope
    6 |   for(int i=0;i<N;i++) pos[s[i]]=i;
      |                            ^
sorting.cpp:10:16: error: 's' was not declared in this scope
   10 |       Q[i]=pos[s[i]];
      |                ^
sorting.cpp:15:12: error: 'n' was not declared in this scope
   15 |     return n;
      |            ^
sorting.cpp:4:30: warning: unused parameter 'S' [-Wunused-parameter]
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                          ~~~~^~~
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[]) {
      |                                                   ~~~~^~~