fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int N=1e6+4;
  4. long long a[N],n;
  5. int main()
  6. {
  7. cin>>n;
  8. for(int i=1;i<=n;i++) cin>>a[i];
  9. for(int i=1;i<=n-1;i++)
  10. {
  11. long long minn=i;
  12. for(int j=i+1;j<=n;j++)
  13. {
  14. if(a[j]<a[minn]) minn=j;
  15. }
  16. swap(a[i],a[minn]);
  17. cout<<"Buoc "<<i<<": ";
  18. for(int x=1;x<=n;x++) cout<<a[x]<<" ";
  19. cout<<endl;
  20. }
  21. }
  22.  
Success #stdin #stdout 0.01s 5540KB
stdin
Standard input is empty
stdout
Standard output is empty