Files
python/TangDou/AcWing/Queue/829_0.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

22 lines
478 B
C++

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int q[N], hh, tt;
int main() {
int n;
cin >> n;
while (n--) {
string op;
cin >> op;
if (op == "push")
cin >> q[tt++];
else if (op == "empty")
hh >= tt ? cout << "YES" << endl : cout << "NO" << endl;
else if (op == "query")
cout << q[hh] << endl;
else
hh++;
}
return 0;
}