Submission #65674

# Submission time Handle Problem Language Result Execution time Memory
65674 2018-08-08T11:37:04 Z mirbek01 Sorting (IOI15_sorting) C++17
0 / 100
6 ms 512 KB
#include "sorting.h"

# include <bits/stdc++.h>

using namespace std;

int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
{
      int sz = 0;
      for (int i = 0; i < n; i++)
      {
            bool fl = true;
            for (int j = 0; j < n; j++)
                  if (ar[j] != j)
                        fl = false;

            if (fl) break;
            for (int j = i; j < n; j++)
            {
                  if ( ar[j] == i )
                  {
                        swap(ar[j], ar[i]);
                        p[sz] = i;
                        q[sz] = j;
                        sz++;
                        break;
                  }
            }
      }
      return sz;
}

Compilation message

sorting.cpp: In function 'int findSwapPairs(int, int*, int, int*, int*, int*, int*)':
sorting.cpp:7:40: warning: unused parameter 'm' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                        ^
sorting.cpp:7:49: warning: unused parameter 'x' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                                 ^
sorting.cpp:7:58: warning: unused parameter 'y' [-Wunused-parameter]
 int findSwapPairs(int n, int ar[], int m, int x[], int y[], int p[], int q[])
                                                          ^
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 512 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Incorrect 2 ms 256 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -