제출 #65668

#제출 시각아이디문제언어결과실행 시간메모리
65668mirbek01정렬하기 (IOI15_sorting)C++17
0 / 100
8 ms512 KiB
#include "sorting.h" # include <bits/stdc++.h> using namespace std; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int sz = 0; set <int> st; for(int i = N - 1; i >= 0; i --) { assert( S[i] >= 0 && S[i] < N ); st.insert(S[i]); } assert(st.size() == N); for(int i = N - 1; i > 0; i --){ bool fl = 1; for(int j = 0; j < N; j ++){ if(j != S[j]) fl = 0; } if(fl) break; // swap(S[X[sz]], S[Y[sz]]); int pos; for(int j = 0; j < N; j ++){ if(S[j] == i){ pos = j; break; } } swap(S[pos], S[i]); P[sz] = pos, Q[sz] = i; sz ++; } return sz; }

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

In file included from /usr/include/c++/7/cassert:44:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:33,
                 from sorting.cpp:3:
sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:17:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       assert(st.size() == N);
              ~~~~~~~~~~^~~~
sorting.cpp:7:39: warning: unused parameter 'M' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                       ^
sorting.cpp:7: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:7:57: warning: unused parameter 'Y' [-Wunused-parameter]
 int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) {
                                                         ^
sorting.cpp:26:17: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
             int pos;
                 ^~~
#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...