fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int N = 1e5 + 5;
  5. int a[N];
  6. signed main() {
  7. ios_base::sync_with_stdio(false);
  8. cin.tie(NULL), cout.tie(NULL);
  9. int n;
  10. cin >> n;
  11. vector<int> v;
  12. for(int i = 1; i <= n; ++i)
  13. cin >> a[i], v.push_back(a[i]);
  14. sort(v.begin(), v.end());
  15. v.erase(unique(v.begin(), v.end()), v.end());
  16. for(int i = 1; i <= n; ++i)
  17. a[i] = lower_bound(v.begin(), v.end(), a[i]) - v.begin() + 1;
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty