Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define f first
- #define s second
- typedef pair < int, int > p;
- #define A(v) v.begin(), v.end()
- class comp{
- public:
- bool operator ()(const p &a, const p &b) const{
- if(a.f == b.f)return a.s > b.s;
- if(a.f == 0)return 1;
- return 0;
- }
- };
- int main() {
- int n, i, l, r;
- cin >> n;
- multiset < p , comp> ss;
- for(int i = 0; i < n; i++){
- cin >> l >> r;
- ss.insert({l,r});
- }
- for(auto i : ss)cout << i.s << ' ';
- return 0;
- }
Add Comment
Please, Sign In to add comment