Submission #1235916

#TimeUsernameProblemLanguageResultExecution timeMemory
1235916candi_ositos정렬하기 (IOI15_sorting)C++20
Compilation error
0 ms0 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; vector <int> nose; vector <int> nose2; int findSwapPairs(int N, vector <int> S, int M, vector <int> X, vector <int> Y, vector <int> P, vector <int> Q){ int l=0, r=M-1; bool xddd=1; vector <pair <int, int> > mbs; for(int i=0; i<N; ++i){ if(S[i]!=i){ xddd=0; break; } } if(xddd){ return 0; } while(l<r){ cerr<<(l+r)/2<<"\n"; vector <int> aux=S; mbs.resize(0); for(int i=0; i<=(l+r)/2; ++i){ int aguss=aux[X[i]]; aux[X[i]]=aux[Y[i]]; aux[Y[i]]=aguss; } int re=0; for(int i=0; i<N; ++i){ if(aux[i]!=i){ --re; int j=i; while(aux[j]!=j){ int aguss=j; j=aux[j]; mbs.push_back(make_pair(aguss, j)); aux[aguss]=aguss; ++re; } } } if(re<=(l+r)/2){ r=(l+r)/2; } else{ l=(l+r+1)/2; } } vector <int> t; t.resize(N); for(int i=0; i<N; ++i){ t[i]=i; } vector <pair <int, int> > bs; for(int i=0; i<l; ++i){ bs.push_back(make_pair(t[mbs[i].first], t[mbs[i].second])); int aguss=t[X[l-1-i]]; t[X[l-1-i]]=t[Y[l-1-i]]; t[Y[l-1-i]]=aguss; } P.resize(l); Q.resize(l); nose.resize(l); nose2.resize(l); for(int i=0; i<l; ++i){ P[i]=bs[l-1-i].first; Q[i]=bs[l-1-i].second; nose[i]=bs[l-1-i].first; nose2[i]=bs[l-1-i].second; } return l; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccas0x1m.o: in function `main':
grader.c:(.text.startup+0x4e9): undefined reference to `findSwapPairs(int, int*, int, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status