#include <stdio.h>
int n, k, a[100005];
int main() {
scanf("%d%d", &n, &k);
for(int i = 1; i <= n; i++) scanf("%d", a+i);
while(k--) {
for(int i = 1; i < n; i++) {
if(a[i] > a[i+1]) {
int t = a[i];
a[i] = a[i+1];
a[i+1] = t;
}
}
}
for(int i = 1; i <= n; i++) printf("%d ", a[i]);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1472 KB |
Output is correct |
2 |
Correct |
0 ms |
1472 KB |
Output is correct |
3 |
Correct |
0 ms |
1472 KB |
Output is correct |
4 |
Correct |
0 ms |
1472 KB |
Output is correct |
5 |
Correct |
0 ms |
1472 KB |
Output is correct |
6 |
Correct |
0 ms |
1472 KB |
Output is correct |
7 |
Correct |
0 ms |
1472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
1472 KB |
Output is correct |
2 |
Correct |
0 ms |
1472 KB |
Output is correct |
3 |
Correct |
2 ms |
1472 KB |
Output is correct |
4 |
Correct |
2 ms |
1472 KB |
Output is correct |
5 |
Correct |
4 ms |
1472 KB |
Output is correct |
6 |
Correct |
0 ms |
1472 KB |
Output is correct |
7 |
Correct |
5 ms |
1472 KB |
Output is correct |
8 |
Correct |
0 ms |
1472 KB |
Output is correct |
9 |
Correct |
0 ms |
1472 KB |
Output is correct |
10 |
Correct |
3 ms |
1472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
3 |
Correct |
34 ms |
1472 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
5 |
Correct |
113 ms |
1472 KB |
Output is correct |
6 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
8 |
Correct |
29 ms |
1472 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
11 |
Correct |
241 ms |
1472 KB |
Output is correct |
12 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
13 |
Correct |
57 ms |
1472 KB |
Output is correct |
14 |
Correct |
122 ms |
1472 KB |
Output is correct |
15 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
1472 KB |
Output is correct |
2 |
Correct |
239 ms |
1472 KB |
Output is correct |
3 |
Correct |
42 ms |
1472 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
6 |
Correct |
52 ms |
1472 KB |
Output is correct |
7 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
9 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
10 |
Correct |
27 ms |
1472 KB |
Output is correct |
11 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
13 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
1468 KB |
Program timed out |
15 |
Correct |
113 ms |
1472 KB |
Output is correct |