제출 #69026

#제출 시각아이디문제언어결과실행 시간메모리
69026theknife2001정렬하기 (IOI15_sorting)C++17
0 / 100
4 ms512 KiB
#include "sorting.h" #include <bits/stdc++.h> using namespace std; const int NN=555; int b[NN]; int n; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { n=N; for(int i=0;i<n;i++) b[S[i]]=i; int ans=0; for(int j=0;j<M;j++) { b[S[0]]=1; b[S[1]]=0; swap(S[0],S[1]); for(int i=0;i<n;i++) { if(S[i]!=i) break; if(i==n-1) return ans; } for(int i=n-1;i>=0;i--) { if(S[i]!=i) { P[ans]=b[i]; Q[ans]=i; swap(b[i],b[S[i]]); swap(S[i],S[b[S[i]]]); ans++; break ; } } for(int i=0;i<n;i++) { if(S[i]!=i) break; if(i==n-1) return ans; } } return ans; }

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

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:9: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:9:57: warning: unused parameter 'Y' [-Wunused-parameter]
 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...