Created
October 23, 2020 15:23
-
-
Save honux77/a72ae65c97559cd67172fd773ed3b35c to your computer and use it in GitHub Desktop.
BOJ 18870 TE answer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <cstdio> | |
| #include <iostream> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <set> | |
| using namespace std; | |
| using ull = long long int; | |
| int main() | |
| { | |
| ios_base::sync_with_stdio(false); | |
| cin.tie(nullptr); | |
| int n; | |
| cin >> n; | |
| vector<int> a(n); | |
| for (int i = 0; i < n; i++) { | |
| cin >> a[i]; | |
| } | |
| set<int> s(a.begin(), a.end()); | |
| for (auto &i: a) { | |
| auto it = lower_bound(s.begin(), s.end(), i); | |
| cout << distance(s.begin(), it) << " "; | |
| } | |
| cout << "\n"; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment