답안 #358074

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
358074 2021-01-25T05:58:48 Z Sparky_09 정렬하기 (IOI15_sorting) C++17
0 / 100
1 ms 448 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 = i; 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:12:37: warning: unused parameter 'm' [-Wunused-parameter]
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[]){
      |                                               ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 372 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 372 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 372 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 448 KB Output isn't correct
2 Halted 0 ms 0 KB -