OMEGAHEAD_MonkoX

E

Jan 20th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <string>
  4. #include <sstream>
  5. #include <algorithm>
  6. #include <vector>
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <fstream>
  10. #include <stack>
  11. #include <map>
  12. #include <cstring>
  13. #include <cmath>
  14. #include <set>
  15. #include <iterator>
  16. #include <cmath>
  17.  
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22. int N, M;
  23. cin >> N;
  24. string a, str, str2;
  25. vector <string> vec;
  26. map<string, string> d;
  27. for (auto i = 0; i < N + 1; ++i)
  28. {
  29. getline(cin, a);
  30. d.insert({a.substr(0, a.find(' ')), a. substr(a.find(' ') + 1)});
  31. }
  32. cin >> M;
  33. for (auto i = 0; i < M + 1; ++i)
  34. {
  35.  
  36. getline(cin, a);
  37. str = a.substr(0, a.find(' '));
  38. str2 = a.substr(a.find(' ') + 1);
  39. if (str == "read") str = "R";
  40. if (str == "write") str = "W";
  41. if (str == "execute") str = "X";
  42. if (i != 0){
  43. if (d[str2].find(str) != -1) vec.push_back("OK");
  44. else vec.push_back("Access denied");
  45. }
  46. }
  47. for (auto el:vec)
  48. cout << el << endl;
  49. return 0;
  50. }
Add Comment
Please, Sign In to add comment