제출 #160542

#제출 시각아이디문제언어결과실행 시간메모리
160542FiloSanza정렬하기 (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; }

컴파일 시 표준 에러 (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...