제출 #160543

#제출 시각아이디문제언어결과실행 시간메모리
160543FiloSanza정렬하기 (IOI15_sorting)C++14
0 / 100
8 ms376 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 idx1 = -1; int idx0 = -1; 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:14:35: warning: conversion to 'int' from 'long int' may alter its value [-Wconversion]
   int idx = min_element(S+i, S+N) - S;
             ~~~~~~~~~~~~~~~~~~~~~~^~~
sorting.cpp:9:6: warning: unused variable 'idx1' [-Wunused-variable]
  int idx1 = -1;
      ^~~~
sorting.cpp:10:6: warning: unused variable 'idx0' [-Wunused-variable]
  int idx0 = -1;
      ^~~~
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...