Submission #160542

#TimeUsernameProblemLanguageResultExecution timeMemory
160542FiloSanzaSorting (IOI15_sorting)C++14
20 / 100
11 ms464 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[]) { swap(S[X[0]], S[Y[0]]); int cont = 0; for(int i=0; i<N; i++){ int idx = min_element(S+i, S+N) - S; if(idx == i) continue; swap(S[i], S[idx]); P[cont] = i; Q[cont++] = idx; swap(S[X[i]], S[Y[i]]); } if(S[0] > S[1]){ P[cont] = 0; Q[cont++] = 1; } return cont; }

Compilation message (stderr)

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:11:35: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
   int idx = min_element(S+i, S+N) - S;
             ~~~~~~~~~~~~~~~~~~~~~~^~~
sorting.cpp:6:39: warning: unused parameter 'M' [-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...