#include <iostream>
using namespace std;
int main() {
int i,j,n,s,tmp,A[1001];
cin>>n>>s;
for(i=1;i<=n;i++)
cin>>A[i];
for(i=n;i>=n-s+1;i--)
for (j=1;j<=i-1;j++)
if (A[j]>A[j+1]) {
tmp=A[j];
A[j]=A[j+1];
A[j+1]=tmp;
}
for(i=1;i<=n;i++)
cout<<A[i]<<" ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Correct |
0 ms |
1716 KB |
Output is correct |
3 |
Correct |
0 ms |
1716 KB |
Output is correct |
4 |
Correct |
0 ms |
1716 KB |
Output is correct |
5 |
Correct |
0 ms |
1716 KB |
Output is correct |
6 |
Correct |
0 ms |
1716 KB |
Output is correct |
7 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1716 KB |
Output is correct |
2 |
Runtime error |
6 ms |
1716 KB |
SIGSEGV Segmentation fault |
3 |
Runtime error |
0 ms |
1716 KB |
SIGSEGV Segmentation fault |
4 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
5 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
6 |
Runtime error |
3 ms |
1716 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
4 ms |
1716 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
10 |
Correct |
0 ms |
1716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
1712 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
1 ms |
1712 KB |
SIGSEGV Segmentation fault |
3 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
4 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
5 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
6 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
1 ms |
1712 KB |
SIGSEGV Segmentation fault |
10 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
11 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
12 |
Runtime error |
2 ms |
1712 KB |
SIGSEGV Segmentation fault |
13 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
14 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
15 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
3 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
4 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
5 |
Runtime error |
1 ms |
1712 KB |
SIGSEGV Segmentation fault |
6 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
10 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
11 |
Runtime error |
1 ms |
1712 KB |
SIGSEGV Segmentation fault |
12 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
13 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
14 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |
15 |
Runtime error |
0 ms |
1712 KB |
SIGSEGV Segmentation fault |