Submission #434590

# Submission time Handle Problem Language Result Execution time Memory
434590 2021-06-21T12:30:25 Z ismoilov Sorting (IOI15_sorting) C++17
0 / 100
1000 ms 332 KB
#include "sorting.h"
#include <bits/stdc++.h>
using namespace std;
int check(int a[], int n){
    for(int i = 0; i < n; i ++)
        if(a[i] != i)
            return i;
    return -1;
}
int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
    int i = check(s, n);
    while(i != -1){
        swap(s[x[i]], s[y[i]]);
        for(int j = 0; j < n; j ++){
            if(s[j] == i){
                swap(s[j], s[i]);
                p[i] = i, q[i] = j;
            }
        }
        i = check(s, n);
    }
    return n;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:10:39: warning: unused parameter 'm' [-Wunused-parameter]
   10 | int findSwapPairs(int n, int s[], int m, int x[], int y[], int p[], int q[]) {
      |                                   ~~~~^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -