Advertisement
Emiliatan

d794

Mar 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. /* d794             */
  2. /* AC (1.7s, 6.4MB) */
  3. #include <bits/stdc++.h>
  4. #include <ext/pb_ds/assoc_container.hpp>
  5. #include <ext/pb_ds/tree_policy.hpp>
  6.  
  7. using namespace std;
  8. using namespace __gnu_pbds;
  9.  
  10. typedef long long int64;
  11. typedef tree<int64, null_type, greater<int64>, rb_tree_tag, tree_order_statistics_node_update> AVL;
  12.  
  13. AVL T;
  14. int N;
  15. int64 n;
  16.  
  17. int main()
  18. {
  19.     while(~scanf("%d", &N))
  20.     {
  21.         T.clear();
  22.         while(N--&&scanf("%lld", &n))
  23.         {
  24.             T.insert(n);
  25.             printf("%d\n", T.order_of_key(n) + 1);
  26.         }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement