답안 #358073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
358073 2021-01-25T05:58:09 Z Sparky_09 정렬하기 (IOI15_sorting) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;

#include "sorting.h"
int findSwapPairs(int n,int s[],int m,int x[],int y[],int P[],int Q[]){
  int ans = 0;
  int wh=0;
  for(int i = 0; i < n; i++){
    int m = i;
    for(int j = il j < n; j++){
      if(s[j] < s[m]){
        m = j;
      }
    }
    if(i!=m) ans++;
    if(i!=m){ P[wh]=i; Q[wh]=m; wh++; }
    swap(i, m);
  }
  return ans;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:16:9: warning: declaration of 'int m' shadows a parameter [-Wshadow]
   16 |     int m = i;
      |         ^
sorting.cpp:12:37: note: shadowed declaration is here
   12 | int findSwapPairs(int n,int s[],int m,int x[],int y[],int P[],int Q[]){
      |                                 ~~~~^
sorting.cpp:17:17: error: 'il' was not declared in this scope; did you mean 'i'?
   17 |     for(int j = il j < n; j++){
      |                 ^~
      |                 i
sorting.cpp:17:30: error: expected ';' before ')' token
   17 |     for(int j = il j < n; j++){
      |                              ^
      |                              ;
sorting.cpp:12:37: warning: unused parameter 'm' [-Wunused-parameter]
   12 | int findSwapPairs(int n,int s[],int m,int x[],int y[],int P[],int Q[]){
      |                                 ~~~~^
sorting.cpp:12:43: warning: unused parameter 'x' [-Wunused-parameter]
   12 | int findSwapPairs(int n,int s[],int m,int x[],int y[],int P[],int Q[]){
      |                                       ~~~~^~~
sorting.cpp:12:51: warning: unused parameter 'y' [-Wunused-parameter]
   12 | int findSwapPairs(int n,int s[],int m,int x[],int y[],int P[],int Q[]){
      |                                               ~~~~^~~