#include <iostream>
using namespace std;
int main()
{
int i, j, t, n, k, num[100000];
// N과 K를 입력받는다.
cin >> n >> k;
// 수를 N번 입력받는다.
for(i=0;i<n;i++) cin >> num[i];
// n[i]와 n[i+1]을 비교해서, n[i]가 더 크면 뒤로 보낸다. 이걸 K번 한다.
for(i=0;i<k;i++)
{
for(j=0;j<n-1;j++)
{
if(num[j]>num[j+1])
{
t=num[j];num[j]=num[j+1];num[j+1]=t;
}
}
}
// 결과를 출력한다.
for(i=0;i<n;i++) cout << num[i] << " ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1980 KB |
Output is correct |
2 |
Correct |
0 ms |
1980 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 |
1984 KB |
Output is correct |
6 |
Correct |
0 ms |
1984 KB |
Output is correct |
7 |
Correct |
0 ms |
1984 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1980 KB |
Output is correct |
2 |
Correct |
4 ms |
1984 KB |
Output is correct |
3 |
Correct |
5 ms |
1980 KB |
Output is correct |
4 |
Correct |
4 ms |
1984 KB |
Output is correct |
5 |
Correct |
1 ms |
1980 KB |
Output is correct |
6 |
Correct |
0 ms |
1980 KB |
Output is correct |
7 |
Correct |
4 ms |
1984 KB |
Output is correct |
8 |
Correct |
8 ms |
1980 KB |
Output is correct |
9 |
Correct |
0 ms |
1980 KB |
Output is correct |
10 |
Correct |
0 ms |
1980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
2 |
Correct |
67 ms |
1984 KB |
Output is correct |
3 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
4 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
5 |
Correct |
61 ms |
1980 KB |
Output is correct |
6 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
8 |
Execution timed out |
1000 ms |
1972 KB |
Program timed out |
9 |
Correct |
144 ms |
1980 KB |
Output is correct |
10 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
11 |
Execution timed out |
1000 ms |
1972 KB |
Program timed out |
12 |
Correct |
115 ms |
1980 KB |
Output is correct |
13 |
Correct |
77 ms |
1984 KB |
Output is correct |
14 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
15 |
Correct |
281 ms |
1980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
2 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
3 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
4 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
5 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
6 |
Execution timed out |
1000 ms |
1976 KB |
Program timed out |
7 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
8 |
Correct |
64 ms |
1980 KB |
Output is correct |
9 |
Correct |
70 ms |
1980 KB |
Output is correct |
10 |
Correct |
140 ms |
1980 KB |
Output is correct |
11 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
12 |
Correct |
122 ms |
1980 KB |
Output is correct |
13 |
Correct |
280 ms |
1980 KB |
Output is correct |
14 |
Execution timed out |
1000 ms |
1980 KB |
Program timed out |
15 |
Correct |
69 ms |
1980 KB |
Output is correct |