Submission #793658

#TimeUsernameProblemLanguageResultExecution timeMemory
793658Jarif_RahmanSorting (IOI15_sorting)C++17
16 / 100
1 ms340 KiB
#include "sorting.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){ vector<int> pos(n); for(int i = 0; i < n; i++) pos[S[i]] = i; int ans = 0; for(int i = 2; i < n; i++){ if(i == S[i]) continue; swap(S[0], S[1]); swap(pos[S[0]], pos[S[1]]); P[ans] = i, Q[ans] = pos[i]; ans++; swap(pos[S[i]], pos[i]); swap(S[i], S[pos[S[i]]]); } if(S[0] != 0) P[ans] = 0, Q[ans] = 0, ans++; return ans; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:10:39: warning: unused parameter 'm' [-Wunused-parameter]
   10 | int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){
      |                                   ~~~~^
sorting.cpp:10:46: warning: unused parameter 'X' [-Wunused-parameter]
   10 | int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){
      |                                          ~~~~^~~
sorting.cpp:10:55: warning: unused parameter 'Y' [-Wunused-parameter]
   10 | 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...