제출 #432561

#제출 시각아이디문제언어결과실행 시간메모리
432561daniel920712정렬하기 (IOI15_sorting)C++14
8 / 100
1085 ms332 KiB
#include "sorting.h" #include <iostream> using namespace std; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int i,j,now=0,ok; for(i=N-1;i>=0;i--) { ok=1; for(j=0;j<N;j++) if(S[j]!=j) ok=0; if(ok) break; swap(S[X[now]],S[Y[now]]); for(j=0;j<N;j++) { if(S[j]==i) { if(i!=j) { P[now]=i; Q[now]=j; } else { P[now]=1; Q[now]=0; } swap(S[P[now]],S[Q[now]]); now++; break; } } } for(j=0;j<N;j++) if(S[j]!=j) while(1); return now; }

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

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:34:34: warning: this 'while' clause does not guard... [-Wmisleading-indentation]
   34 |     for(j=0;j<N;j++) if(S[j]!=j) while(1);
      |                                  ^~~~~
sorting.cpp:35:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'while'
   35 |  return now;
      |  ^~~~~~
sorting.cpp:4:39: warning: unused parameter 'M' [-Wunused-parameter]
    4 | int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[])
      |                                   ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...