智灵普及STL T3TLE 72pts求调

rt,进入优先队列再出队太慢了,有人知道如何优化吗
id:7782

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+100;
queue<int> q;
int t;
void _1(){
	int x;
	cin>>x;
	q.push(x);
}
void _2(){
	cout<<q.front()<<endl;
	q.pop();
}
void _3(){
	priority_queue<int,vector<int>,greater<int> > pq;
	while(!q.empty()){
		pq.push(q.front());
		q.pop();
	}
	while(!pq.empty()){
		q.push(pq.top());
		pq.pop();
	}
}
void solve(){
	int idx;
	cin>>idx;
	if(idx==1) _1();
	else if(idx==2) _2();
	else _3();
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}