Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. #include <vector>
  5.  
  6. #include <string>
  7.  
  8. #include <cstdio>
  9.  
  10. #include <algorithm>
  11.  
  12. #include <cmath>
  13.  
  14. #include <queue>
  15.  
  16.  
  17.  
  18. using namespace std;
  19.  
  20.  
  21.  
  22. int main() {
  23.  
  24.     ios_base::sync_with_stdio(false);
  25.  
  26.     cin.tie(0);
  27.  
  28.     cin.tie(0);
  29.  
  30.     int n, k;
  31.  
  32.     bool t = false;
  33.  
  34.     cin >> n;
  35.  
  36.     vector<int> info;
  37.  
  38.     vector<int> answer;
  39.  
  40.     for (int i = 1; i <= n; i++) {
  41.  
  42.         cin >> k;
  43.  
  44.         info.push_back(k);
  45.  
  46.     }
  47.  
  48.     for (int i = 0; i <n; i++) {
  49.  
  50.         k = info[i];
  51.  
  52.         for (int y = i+1; y <n; y++) {
  53.  
  54.             if (info[y] < k) {
  55.  
  56.                 answer.push_back(y);
  57.  
  58.                 t = true;
  59.  
  60.                 break;
  61.  
  62.             }
  63.  
  64.         }
  65.  
  66.         if (t) {
  67.  
  68.             t = false;
  69.  
  70.             continue;
  71.  
  72.         }
  73.  
  74.         else { answer.push_back(-1); }
  75.  
  76.     }
  77.  
  78.     for (int k : answer)
  79.  
  80.         cout << k<<endl;
  81.  
  82.     return 0;
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement