Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include<string>
- using namespace std;
- int main() {
- int operation;
- int people;
- vector<bool> silent;
- int sum=0;
- cin >> operation;
- for (int i = 0; i < operation; i++)
- {
- string check;
- cin >> check;
- if (check=="COME"){
- cin >> people;
- if (people>0)
- {
- silent.assign(silent.size()+people,false);
- }
- else
- {
- silent.resize(silent.size() + people);
- }
- }
- else if(check=="WORRY")
- {
- cin >> people;
- silent[people] = true;
- }
- else if (check == "QUIET")
- {
- cin >> people;
- silent[people] = false;
- }
- else if (check == "WORRY_COUNT")
- {
- for (auto k : silent) {
- if (k==true)
- {
- sum++;
- }
- }
- cout << sum<<endl;
- }
- else
- {
- cout << " " << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement