답안 #1011675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011675 2024-07-01T04:57:14 Z irmuun 정렬하기 (IOI15_sorting) C++17
0 / 100
1 ms 412 KB
#include<bits/stdc++.h>
#include "sorting.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){//P Q is answers
    int r=0;
    while(true){
        r++;
        bool found=false;
        for(int i=0;i<n;i++){
            if(S[i]!=i){
                found=true;
                P[r]=i;
                Q[r]=S[i];
                swap(S[P[r]],S[Q[r]]);
                r++;
                break;
            }
        }
        if(!found) break;
    }
    return r;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:13:39: warning: unused parameter 'm' [-Wunused-parameter]
   13 | int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){//P Q is answers
      |                                   ~~~~^
sorting.cpp:13:46: warning: unused parameter 'X' [-Wunused-parameter]
   13 | int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){//P Q is answers
      |                                          ~~~~^~~
sorting.cpp:13:55: warning: unused parameter 'Y' [-Wunused-parameter]
   13 | int findSwapPairs(int n, int S[], int m, int X[], int Y[], int P[], int Q[]){//P Q is answers
      |                                                   ~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 412 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 412 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 412 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -