Submission #1098361

#TimeUsernameProblemLanguageResultExecution timeMemory
1098361alexander707070Sorting (IOI15_sorting)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "sorting.h" #define MAXN 200007 using namespace std; int n,m; int pos[MAXN]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { n=N; m=M; for(int i=0;i<n;i++){ pos[s[i]]=i; } for(int i=0;i<n;i++){ P[i]=i; Q[i]=pos[i]; swap(s[i],s[pos[i]]); swap(pos[s[i]],pos[s[pos[i]]]); } return n; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:14:7: error: 's' was not declared in this scope
   14 |   pos[s[i]]=i;
      |       ^
sorting.cpp:20:8: error: 's' was not declared in this scope
   20 |   swap(s[i],s[pos[i]]);
      |        ^
sorting.cpp:10:30: warning: unused parameter 'S' [-Wunused-parameter]
   10 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                          ~~~~^~~
sorting.cpp:10:46: warning: unused parameter 'X' [-Wunused-parameter]
   10 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                          ~~~~^~~
sorting.cpp:10:55: warning: unused parameter 'Y' [-Wunused-parameter]
   10 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
      |                                                   ~~~~^~~