This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
void swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
}
int main(void)
{
int N, K, arr[100000];
scanf("%d%d", &N, &K);
for (int i = 0; i < N; i++)
scanf("%d", arr + i);
for (int i = 0; i < K; i++)
for (int j = 0; j < N - 1; j++)
if (arr[j] > arr[j + 1])
swap(arr + j, arr + j + 1);
for (int i = 0; i < N; i++)
printf("%d ", arr[i]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |