제출 #137996

#제출 시각아이디문제언어결과실행 시간메모리
137996arthurconmy정렬하기 (IOI15_sorting)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]) { // cout << n << endl; for(int i=0; i<n; i++) { eend[i]=S[i]; } for(int i=0; i<m; i++) { swap(eend[X[i]],eend[Y[i]]); } //f//or(int i=0; i<n; i++) //{ //cout << i << " " << eend[i] << endl; //} // return 7; int cur_sort=0; // cout << "HERE" << endl; for(int i=0; i<m; i++) { //cout << i << endl; swap(eend[X[i]],eend[Y[i]]); swap(S[X[i]],S[Y[i]]); bool upd=0; while(cur_sort < n) { // find cur_sort in both arrays int pos_s=-1; int pos_e=-1; for(int j=0; j<n; i++) { if(S[j]==cur_sort) pos_s=j; if(eend[j]==cur_sort) pos_e=j; } if(pos_e == pos_s) { // cout << cur_sort << " is sorted bro" << endl; cur_sort++; continue; } swap(S[pos_s],S[pos_e]); P[i]=pos_s; Q[i]=pos_e; upd=1; cur_sort++; break; } if(!upd) { P[i]=0; Q[i]=0; } // cout << P[i] << " " << Q[i] << endl; } return m; }

컴파일 시 표준 에러 (stderr) 메시지

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:10:3: error: 'eend' was not declared in this scope
   eend[i]=S[i];
   ^~~~
sorting.cpp:10:3: note: suggested alternative: 'rand'
   eend[i]=S[i];
   ^~~~
   rand
sorting.cpp:15:8: error: 'eend' was not declared in this scope
   swap(eend[X[i]],eend[Y[i]]);
        ^~~~
sorting.cpp:15:8: note: suggested alternative: 'rand'
   swap(eend[X[i]],eend[Y[i]]);
        ^~~~
        rand
sorting.cpp:33:8: error: 'eend' was not declared in this scope
   swap(eend[X[i]],eend[Y[i]]);
        ^~~~
sorting.cpp:33:8: note: suggested alternative: 'rand'
   swap(eend[X[i]],eend[Y[i]]);
        ^~~~
        rand