Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n; cin >> n;
- vector<pair<__int128_t, string>> pos(n);
- for (int i = 0; i < n; i++) {
- long long cc; cin >> cc;
- __int128_t c = cc;
- string b; cin >> b;
- pos[i].second = to_string(cc) + " " + b;
- for (char u : b) {
- if (u == 'g') c *= 1;
- if (u == 'p') c *= 16380;
- if (u == 't') c *= 1000000;
- if (u == 'm') c *= 1;
- if (u == 'k') c *= 1000000;
- if (u == 'M') c *= 1000000000;
- if (u == 'G') c *= 1000000000000;
- }
- if (b.size() == 1) c *= 1000;
- pos[i].first = c;
- }
- stable_sort(pos.begin(), pos.end(), [](auto p1, auto p2) {return p1.first < p2.first;});
- for (auto [c, s] : pos) {
- cout << s << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement