Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <string>
- #include <sstream>
- #include <algorithm>
- #include <vector>
- #include <stdlib.h>
- #include <stdio.h>
- #include <fstream>
- #include <stack>
- #include <map>
- #include <cstring>
- #include <cmath>
- #include <set>
- #include <iterator>
- #include <cmath>
- using namespace std;
- int main()
- {
- int N, M;
- cin >> N;
- string a, str, str2;
- vector <string> vec;
- map<string, string> d;
- for (auto i = 0; i < N + 1; ++i)
- {
- getline(cin, a);
- d.insert({a.substr(0, a.find(' ')), a. substr(a.find(' ') + 1)});
- }
- cin >> M;
- for (auto i = 0; i < M + 1; ++i)
- {
- getline(cin, a);
- str = a.substr(0, a.find(' '));
- str2 = a.substr(a.find(' ') + 1);
- if (str == "read") str = "R";
- if (str == "write") str = "W";
- if (str == "execute") str = "X";
- if (i != 0){
- if (d[str2].find(str) != -1) vec.push_back("OK");
- else vec.push_back("Access denied");
- }
- }
- for (auto el:vec)
- cout << el << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment