답안 #434481

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
434481 2021-06-21T11:03:18 Z ismoilov 정렬하기 (IOI15_sorting) C++14
컴파일 오류
0 ms 0 KB
#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[]) {
	for(int i = 0; i < n; i ++){
        int x = i;
        for(int j = 0; j < n; j ++){
            if(a[j] == i){
                p[i] = j, q[i] = i, swap(s[j], s[i]);
                break;
            }
        }
	}
	return n;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:7:13: warning: declaration of 'int x' shadows a parameter [-Wshadow]
    7 |         int x = i;
      |             ^
sorting.cpp:5:46: note: shadowed declaration is here
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                          ~~~~^~~
sorting.cpp:9:16: error: 'a' was not declared in this scope
    9 |             if(a[j] == i){
      |                ^
sorting.cpp:7:13: warning: unused variable 'x' [-Wunused-variable]
    7 |         int x = i;
      |             ^
sorting.cpp:5:39: warning: unused parameter 'm' [-Wunused-parameter]
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                   ~~~~^
sorting.cpp:5:46: warning: unused parameter 'x' [-Wunused-parameter]
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                          ~~~~^~~
sorting.cpp:5:55: warning: unused parameter 'y' [-Wunused-parameter]
    5 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                                   ~~~~^~~