#include <iostream>
using namespace std;
int main() {
int i,j,n,s,tmp,A[100001];
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 |
1980 KB |
Output is correct |
2 |
Correct |
0 ms |
1984 KB |
Output is correct |
3 |
Correct |
0 ms |
1980 KB |
Output is correct |
4 |
Correct |
0 ms |
1980 KB |
Output is correct |
5 |
Correct |
0 ms |
1980 KB |
Output is correct |
6 |
Correct |
0 ms |
1980 KB |
Output is correct |
7 |
Correct |
0 ms |
1980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1984 KB |
Output is correct |
2 |
Correct |
0 ms |
1980 KB |
Output is correct |
3 |
Correct |
0 ms |
1984 KB |
Output is correct |
4 |
Correct |
4 ms |
1984 KB |
Output is correct |
5 |
Correct |
0 ms |
1980 KB |
Output is correct |
6 |
Correct |
4 ms |
1984 KB |
Output is correct |
7 |
Correct |
0 ms |
1984 KB |
Output is correct |
8 |
Correct |
0 ms |
1980 KB |
Output is correct |
9 |
Correct |
4 ms |
1980 KB |
Output is correct |
10 |
Correct |
3 ms |
1980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
148 ms |
1980 KB |
Output is correct |
2 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
3 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
4 |
Correct |
284 ms |
1984 KB |
Output is correct |
5 |
Execution timed out |
1000 ms |
1972 KB |
Program timed out |
6 |
Correct |
67 ms |
1984 KB |
Output is correct |
7 |
Correct |
121 ms |
1980 KB |
Output is correct |
8 |
Correct |
88 ms |
1984 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
11 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
12 |
Correct |
57 ms |
1980 KB |
Output is correct |
13 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
14 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
15 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
3 |
Correct |
85 ms |
1984 KB |
Output is correct |
4 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
1972 KB |
Program timed out |
7 |
Correct |
293 ms |
1980 KB |
Output is correct |
8 |
Correct |
138 ms |
1980 KB |
Output is correct |
9 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
10 |
Execution timed out |
1000 ms |
1972 KB |
Program timed out |
11 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
12 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
13 |
Correct |
72 ms |
1980 KB |
Output is correct |
14 |
Correct |
45 ms |
1980 KB |
Output is correct |
15 |
Correct |
121 ms |
1980 KB |
Output is correct |