Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <iostream>
- #include <vector>
- using namespace std;
- int N;
- const int MAXN = 1000000;
- vector<int> v(MAXN);
- int main() {
- cin >> N;
- int level = 0;
- for (int i = 0; i < N; ++i) {
- string command;
- int element;
- cin >> command;
- if (command == "UPALI") {
- cin >> element;
- if (v[element] <= level) {
- v[element] = level + 1;
- }
- } else if (command == "PROVJERI") {
- cin >> element;
- if (v[element] > level) {
- cout << "IMA" << endl;
- } else {
- cout << "NEMA" << endl;
- }
- } else if (command == "UGASI") {
- cin >> element;
- if (v[element] > level) {
- --v[element];
- }
- } else if (command == "RESET") {
- ++level;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement