Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- void PrintVector(const vector<bool>& v)
- {
- for (int i = 0; i != v.size(); ++i)
- {
- cout << v[i] << endl;
- }
- }
- void PrintVector2(const vector<string>& v)
- {
- for (int i = 0; i != v.size(); ++i)
- {
- cout << v[i] << endl;
- }
- }
- int Summ(const vector<int>& v)
- {
- int fact = 0;
- for (int i = 0; i != v.size(); i++)
- {
- fact = fact + v[i];
- }
- return fact;
- }
- int main()
- {
- int n;
- int d = 0;
- vector <bool> person(0);
- cin >> n;
- vector<string> v(n);
- vector<int> k(n);
- vector <int> pechat(100);
- vector <int> vivod(100);
- int metka = 0;
- int x=0;
- int metka2=0;
- for (int i = 0; i != n; ++i)
- {
- cin >> v[i];
- if (v[i] == "COME")
- {
- cin >> d;
- person.resize(person.size()+d,false);
- }
- if (v[i] == "WORRY")
- {
- cin >> d;
- person[d] = true;
- }
- if (v[i] == "QUIET")
- {
- cin >> d;
- person[d] = false;
- }
- if (v[i] == "WORRY_COUNT")
- {
- for (int j = 0; j != person.size(); ++j)
- {
- if (person[j] != 0)
- {
- pechat[metka] = 1;
- metka = metka + 1;
- }
- }
- for (int j = 0; j != 99; ++j)
- {
- if (pechat[j] != 0)
- {
- x = x + 1;
- }
- }
- for (int j = 0; j != 99; ++j)
- {
- pechat[j] = 0;
- }
- if (x <1) { x = 5;}
- vivod[metka2] = x;
- x = 0;
- metka2 = metka2 + 1;
- }
- }
- for (int j = 0; j != 99; ++j)
- {
- if (vivod[j] != 0)
- {
- if (vivod[j] > 2) { vivod[j] =0;}
- cout << vivod[j] << endl;
- }
- }
- // PrintVector2(v);
- //PrintVector(person);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement