Submission #1195172

#TimeUsernameProblemLanguageResultExecution timeMemory
1195172nikulidSorting (IOI15_sorting)C++20
0 / 100
1 ms328 KiB
#include "sorting.h" #include <vector> using namespace std; int findSwapPairs(int N, int S[], int M, int X[], int Y[], int P[], int Q[]) { int next; //bool already_sorted; //bool CHECKING=false, DEBUG=false; // we are given S[], M, X[], Y[] // we are to give P[], Q[] vector<int> ns(N); for(int i=0; i<N; i++){ ns[i] = S[i]; } /*if(DEBUG) { for(auto x:ns){ cout<<x<<" "; }cout<<"\n\n"; }*/ for(int i=0; i<N; i++){ for(int j=0; j<N; j++){ if(ns[j] == i){ next = j; break; } } P[i] = i; Q[i] = next; swap(ns[i], ns[next]); // we have "swapped" positions `i` and `trans[i]`. whatever that means. } /*for(auto x:ns){ cout<<x<<" "; }cout<<"\n\n";*/ return N; }
#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...