Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #define ll long long
- #define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
- #define N ((int)1e6 + 9)
- #define endl "\n"
- using namespace std;
- /*fast io
- ios_base::sync_with_stdio(false);
- cin.tie(NULL);
- */
- /// priority queue
- int main()
- {
- // fastio;
- int n;
- cin>>n;
- priority_queue < int > pqq;
- while(n > 0){
- n--;
- int a;
- cin>>a;
- pqq.push(-a); /// O ( logn )
- }
- while(pqq.empty() == 0){
- int a = pqq.top(); /// O ( logn ) /// log ( 1e6 ) = 20
- cout<<a<<" "<<-a<<endl;
- pqq.pop(); /// O ( logn )
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement