Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main() {
- int q;
- cin >> q;
- vector<bool>queue;
- for (int i = 0; i < q; ++i) {
- string operation_code;
- cin >> operation_code;
- if (operation_code == "WORRY"s) {
- int index;
- cin >> index;
- queue[index] = true;
- }
- else if (operation_code == "HAPPY"s) {
- int index;
- cin >> index;
- queue[index] = false;
- }
- else if (operation_code == "COME"s) {
- int count;
- cin >> count;
- queue.resize(queue.size()+count, false);
- }
- else if (operation_code == "LAST_WORRY"s) {
- if (!queue.empty()) {
- if (queue.back() == true) {
- cout << "worry" << endl;
- }
- else if (queue.back() == false) {
- cout << "happy" << endl;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement