Submission #160541

#TimeUsernameProblemLanguageResultExecution timeMemory
160541FiloSanzaSorting (IOI15_sorting)C++14
0 / 100
13 ms504 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, S+N) - S; 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:33: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
   int idx = min_element(S, 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...