Submission #520723

# Submission time Handle Problem Language Result Execution time Memory
520723 2022-01-30T23:07:14 Z peti1234 Sorting (IOI15_sorting) C++17
Compilation error
0 ms 0 KB
#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++) {
        for (int j=i; j<n; j++) {
            if (s[j]==i) {
                p[i]=i, q[i]=j;
                swap(s[i], s[j])
            }
        }
    }
    return n;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:10:33: error: expected ';' before '}' token
   10 |                 swap(s[i], s[j])
      |                                 ^
      |                                 ;
   11 |             }
      |             ~                    
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[]) {
      |                                                   ~~~~^~~