Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int n;
  6. cin»n;
  7. int a[n];
  8. for(int i=0;i<n;i++)cin»a[i];
  9. int out=-1;
  10. for(int i=0;i<n-1;i++){
  11. for(int j=i+1;j<n;j++)
  12. if(a[i]>a[j]){
  13. out=j;
  14. break;
  15. }
  16. cout«out«' ';out=-1;
  17. }
  18.  
  19. cout«-1;
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement