You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
478 B
22 lines
478 B
#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;
|
|
} |