답안 #1011676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011676 2024-07-01T04:58:15 Z irmuun 정렬하기 (IOI15_sorting) C++17
20 / 100
1 ms 348 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){
        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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Incorrect 0 ms 344 KB Output isn't correct
15 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 -