#include "grader.h"
void q_sort(int left, int right, int *A) {
int i, j, pivot;
int temp;
i = pivot = left;
j = right;
if (i < j) {
while (i < j) {
while ((i < j) && (*(A + i) < *(A + pivot))) i++;
while ((i < j) && (*(A + j) >= *(A + pivot))) j--;
if (i < j) {
temp = *(A + i);
*(A + i) = *(A + j);
*(A + j) = temp;
}
}
temp = *(A + pivot);
*(A + pivot) = *(A + j);
*(A + j) = temp;
q_sort(left, j - 1, A);
q_sort(j + 1, right, A);
}
}
void sort_even(int N, int *A) {
int i;
q_sort(0, N - 1, A);
for (i = 0; i < N; i++) {
if (A[i] % 2 == 0) Report(A[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1084 KB |
Output is correct |
2 |
Correct |
0 ms |
1084 KB |
Output is correct |
3 |
Correct |
0 ms |
1084 KB |
Output is correct |
4 |
Correct |
0 ms |
1084 KB |
Output is correct |
5 |
Correct |
0 ms |
1084 KB |
Output is correct |
6 |
Correct |
0 ms |
1084 KB |
Output is correct |
7 |
Correct |
0 ms |
1084 KB |
Output is correct |
8 |
Correct |
0 ms |
1084 KB |
Output is correct |