Advertisement
Mirandek

Untitled

Aug 19th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int N;
  7. const int MAXN = 1000000;
  8. vector<int> v(MAXN);
  9.  
  10. int main() {
  11.     cin >> N;
  12.     int level = 0;
  13.     for (int i = 0; i < N; ++i) {
  14.         string command;
  15.         int element;
  16.  
  17.         cin >> command;
  18.         if (command == "UPALI") {
  19.             cin >> element;
  20.             if (v[element] <= level) {
  21.                 v[element] = level + 1;
  22.             }
  23.         } else if (command == "PROVJERI") {
  24.             cin >> element;
  25.             if (v[element] > level) {
  26.                 cout << "IMA" << endl;
  27.             } else {
  28.                 cout << "NEMA" << endl;
  29.             }
  30.         } else if (command == "UGASI") {
  31.             cin >> element;
  32.             if (v[element] > level) {
  33.                 --v[element];
  34.             }
  35.         } else if (command == "RESET") {
  36.             ++level;
  37.         }
  38.     }
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement