Submission #94891

#TimeUsernameProblemLanguageResultExecution timeMemory
94891someone_aaSorting (IOI15_sorting)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "sorting.h" using namespace std; const int maxn = 110; int value[maxn], index[maxn]; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int br = 0; for(int i=0;i<N;i++) { value[i] = S[i]; index[S[i]] = i; } for(int i=0;i<N;i++) { if(value[i] == i) continue; P[br] = i; Q[br] = index[i]; index[value[i]] = index[i]; value[index[i]] = value[i]; value[i] = i; index[i] = i; br++; } return br; }

Compilation message (stderr)

sorting.cpp:5:28: error: 'int index [110]' redeclared as different kind of symbol
 int value[maxn], index[maxn];
                            ^
In file included from /usr/include/c++/7/cstring:42:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:48,
                 from sorting.cpp:1:
/usr/include/string.h:477:1: note: previous declaration 'const char* index(const char*, int)'
 index (const char *__s, int __c) __THROW
 ^~~~~
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:12:19: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         index[S[i]] = i;
                   ^
sorting.cpp:19:24: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         Q[br] = index[i];
                        ^
sorting.cpp:21:23: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         index[value[i]] = index[i];
                       ^
sorting.cpp:21:34: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         index[value[i]] = index[i];
                                  ^
sorting.cpp:22:22: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         value[index[i]] = value[i];
                      ^
sorting.cpp:24:16: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
         index[i] = i;
                ^
sorting.cpp:7:39: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                       ^
sorting.cpp:7:48: warning: unused parameter 'X' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                ^
sorting.cpp:7:57: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                         ^