fork download
  1. // iostream is too mainstream
  2. #include <cstdio>
  3. // bitch please
  4. #include <iostream>
  5. #include <algorithm>
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <set>
  9. #include <map>
  10. #include <queue>
  11. #include <stack>
  12. #include <list>
  13. #include <cmath>
  14. #include <iomanip>
  15. #define dibs reserve
  16. #define OVER9000 1234567890
  17. #define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
  18. #define tisic 47
  19. #define soclose 1e-6
  20. #define chocolate win
  21. // so much chocolate
  22. #define patkan 9
  23. #define ff first
  24. #define ss second
  25. #define abs(x) ((x < 0)?-(x):x)
  26. #define uint unsigned int
  27. using namespace std;
  28. // mylittledoge
  29.  
  30. int main() {
  31. cin.sync_with_stdio(0);
  32. cin.tie(0);
  33. string s;
  34. set<int> BL;
  35. set<int> X;
  36. map<int,set<int> > T;
  37. while(cin >> s) {
  38. if(s == "#") return 0;
  39. int trid,item;
  40. cin >> trid >> item;
  41. if(BL.find(trid) != BL.end()) {cout << "IGNORED\n"; continue;}
  42. if(s == "X" || X.find(item) != X.end())
  43. if(T.find(item) != T.end() && (T[item].size() > 1 || *T[item].begin() != trid)) {
  44. cout << "DENIED\n";
  45. BL.insert(trid);
  46. continue;}
  47. cout << "GRANTED\n";
  48. T[item].insert(trid);
  49. if(s == "X") X.insert(item);}
  50. return 0;}
  51.  
  52. // look at my code
  53. // my code is amazing
Success #stdin #stdout 0s 3484KB
stdin
Standard input is empty
stdout
Standard output is empty