Open utterances-bot opened 1 year ago
https://oj.luyencode.net/problem/QUEUE
Đây là code mình đã AC, bạn có thể tham khảo: ``
const int N = 1e6+9; using namespace std; ll T, x, n; dequeq; void sub1(){ cin>>n; q.push_back(n); } void sub2(){ if(!q.empty()) q.pop_front(); } void sub3(){ if(q.empty()) cout<<"Empty!"<<'\n'; else cout<<q.front()<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); cin>>T; while(T--){ cin>>x; if(x == 1) sub1(); if(x == 2) sub2(); if(x == 3) sub3(); } } ``
Truy vấn với hàng đợi - Luyện Code Online
https://oj.luyencode.net/problem/QUEUE