Submission #830568

#TimeUsernameProblemLanguageResultExecution timeMemory
830568ShithilaSorting (IOI15_sorting)C++14
Compilation error
0 ms0 KiB
#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 (stderr)

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[]) {
      |                                                   ~~~~^~~