Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- #include <cstdio>
- using namespace std;
- //bool tab[1000000];
- vector<bool> v;
- set<int> s;
- int main()
- {
- int a, b;
- scanf("%i%i",&a,&b);
- for (int i = 0; i < a; i++)
- {
- int x, y;
- scanf("%i%i",&x,&y);
- if (x == 1)
- {
- s.insert(y);
- }
- else
- {
- s.erase(y);
- }
- if (s.count(y - b) == 0 && s.count(y + b) == 0 )
- {
- v.push_back(false);
- }
- else
- {
- v.push_back(true);
- }
- }
- for (int i = 0; i < v.size(); i++)
- {
- const char * napis = (v[i] == 1 ? "TAK" : "NIE");
- printf("%s\n",napis);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement