제출 #65679

#제출 시각아이디문제언어결과실행 시간메모리
65679mirbek01정렬하기 (IOI15_sorting)C++17
컴파일 에러
0 ms0 KiB
#include "sorting.h" # include <bits/stdc++.h> using namespace std; int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[]) { int sz = 0; for (int i = 0; i < n; i++) { bool fl = true; for (int j = 0; j < n; j++) if (ar[j] != j) fl = false; if (fl) break; for (int j = i; j < n; j++) { if ( ar[j] == i ) { swap(ar[j], ar[i]); p[sz] = i; q[sz] = j; sz++; break; } } } for(int i = 0; i < n; i ++){ assert(i == ar[i]); } assert(sz <= M); return sz; }

컴파일 시 표준 에러 (stderr) 메시지

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from sorting.cpp:3:
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:33:20: error: 'M' was not declared in this scope
       assert(sz <= M);
                    ^
sorting.cpp:7:40: warning: unused parameter 'm' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                        ^
sorting.cpp:7:49: warning: unused parameter 'x' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                                 ^
sorting.cpp:7:58: warning: unused parameter 'y' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                                          ^