Submission #20248

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
202482016-07-29 16:53:45AngelosSorting (IOI15_sorting)C++98
Compilation error
0 ms0 KiB
#include "sorting.h"
#include <algorithm>
using namespace std;
int *s, *x, *y, *p, *q, n;
int obj[200005], cur[200005];
int orev[200005], crev[200005];
bool trial(int t){
for(int i=0; i<n; i++){
obj[i] = i;
}
for(int i=t-1; i>=0; i--){
swap(obj[x[i]], obj[y[i]]);
}
for(int i=0; i<n; i++){
orev[obj[i]] = i;
cur[i] = s[i];
crev[cur[i]] = i;
}
int pt = 0;
for(int i=0; i<t; i++){
swap(obj[x[i]], obj[y[i]]);
swap(cur[x[i]], cur[y[i]]);
crev[cur[x[i]]] = x[i];
orev[obj[x[i]]] = x[i];
crev[cur[y[i]]] = y[i];
orev[obj[y[i]]] = y[i];
while(pt < n && crev[pt] == orev[pt]) pt++;
if(pt == n){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:49:9: warning: declaration of 's' shadows a global declaration [-Wshadow]
     int s = 0, e = M;
         ^
sorting.cpp:5:6: note: shadowed declaration is here
 int *s, *x, *y, *p, *q, n;
      ^
sorting.cpp:56:5: error: 'ret' was not declared in this scope
     ret
     ^~~
sorting.cpp:56:5: note: suggested alternative: 'crev'
     ret
     ^~~
     crev
sorting.cpp:56:5: error: expected '}' at end of input
sorting.cpp:56:5: warning: no return statement in function returning non-void [-Wreturn-type]