Advertisement
Guest User

Untitled

a guest
Dec 16th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <set>
  4. #include <cstdio>
  5. using namespace std;
  6. //bool tab[1000000];
  7. vector<bool> v;
  8. set<int> s;
  9.  
  10. int main()
  11. {
  12. int a, b;
  13. scanf("%i%i",&a,&b);
  14. for (int i = 0; i < a; i++)
  15. {
  16. int x, y;
  17. scanf("%i%i",&x,&y);
  18. if (x == 1)
  19. {
  20. s.insert(y);
  21. }
  22. else
  23. {
  24. s.erase(y);
  25. }
  26. if (s.count(y - b) == 0 && s.count(y + b) == 0 )
  27. {
  28. v.push_back(false);
  29. }
  30. else
  31. {
  32. v.push_back(true);
  33. }
  34. }
  35. for (int i = 0; i < v.size(); i++)
  36. {
  37. const char * napis = (v[i] == 1 ? "TAK" : "NIE");
  38. printf("%s\n",napis);
  39. }
  40.  
  41. return 0;
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement