#include<bits/stdc++.h>
using namespace std;
int main(){
int N, K;
cin >> N;
cin >> K;
vector<int> seq;
for(int i = 0; i < N; i++){
int temp;
cin >> temp;
seq.push_back(temp);
}
int po;
po = N - 1;
bool swapped = false;
for (int l = 0; l < po; l++) {
if (seq[l] > seq[l + 1]) {
swap(seq[l], seq[l + 1]);
swapped = true;
}
if (!swapped) break; // Exit early if no swaps
}
for(int ll = 0; ll < N; ll++){
cout << seq[ll] << " ";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |