#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]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1352 KB |
Output is correct |
2 |
Correct |
0 ms |
1348 KB |
Output is correct |
3 |
Correct |
0 ms |
1352 KB |
Output is correct |
4 |
Correct |
0 ms |
1352 KB |
Output is correct |
5 |
Correct |
0 ms |
1352 KB |
Output is correct |
6 |
Correct |
0 ms |
1352 KB |
Output is correct |
7 |
Correct |
0 ms |
1356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1356 KB |
Output is correct |
2 |
Correct |
0 ms |
1348 KB |
Output is correct |
3 |
Correct |
5 ms |
1356 KB |
Output is correct |
4 |
Correct |
0 ms |
1352 KB |
Output is correct |
5 |
Correct |
1 ms |
1348 KB |
Output is correct |
6 |
Correct |
7 ms |
1348 KB |
Output is correct |
7 |
Correct |
4 ms |
1352 KB |
Output is correct |
8 |
Correct |
1 ms |
1352 KB |
Output is correct |
9 |
Correct |
0 ms |
1348 KB |
Output is correct |
10 |
Correct |
0 ms |
1348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
1348 KB |
Output is correct |
2 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
3 |
Correct |
133 ms |
1348 KB |
Output is correct |
4 |
Correct |
43 ms |
1356 KB |
Output is correct |
5 |
Correct |
240 ms |
1356 KB |
Output is correct |
6 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
11 |
Correct |
110 ms |
1352 KB |
Output is correct |
12 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
13 |
Correct |
66 ms |
1352 KB |
Output is correct |
14 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
2 |
Correct |
33 ms |
1348 KB |
Output is correct |
3 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
4 |
Correct |
0 ms |
1348 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
8 |
Correct |
109 ms |
1352 KB |
Output is correct |
9 |
Correct |
240 ms |
1348 KB |
Output is correct |
10 |
Correct |
115 ms |
1352 KB |
Output is correct |
11 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
12 |
Correct |
47 ms |
1352 KB |
Output is correct |
13 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
1344 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
1348 KB |
Program timed out |