Submission #132336

#TimeUsernameProblemLanguageResultExecution timeMemory
132336redaSorting (IOI15_sorting)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std ;
# include "sorting.h"
vector<pair<int,int>>  v;
int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
{
    for(int i=0;i<N;i++)
    {
        v.push_back(make_pair(S[i],i));
    }
    int  c=0;
    sort(v.begin(),v.end());
  int i=0,j=0;
    while(i<n)
    {
        if(v[i].first != S[i]){i++;}
      else {j++;
        q[j]=i;
        p[j]=v[i].second;
        c++;
            i++;
           }
    }
    return c;
}


Compilation message (stderr)

sorting.cpp:5:60: error: 'p' has not been declared
 int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
                                                            ^
sorting.cpp:5:66: error: 'q' has not been declared
 int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
                                                                  ^
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int, int*, int*)':
sorting.cpp:14:13: error: 'n' was not declared in this scope
     while(i<n)
             ^
sorting.cpp:18:9: error: 'q' was not declared in this scope
         q[j]=i;
         ^
sorting.cpp:19:9: error: 'p' was not declared in this scope
         p[j]=v[i].second;
         ^
sorting.cpp:5:39: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
                                       ^
sorting.cpp:5:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
                                                ^
sorting.cpp:5:56: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int  Y,  p[],  q[])
                                                        ^