Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- //int parent[300001], a[300001];
- vector < pair < int, int > > minyc;
- map <pair <int, int>, pair <int, int> > a, b;
- int main()
- {
- int i, k, n, kol, v1, v2, q;
- char bu;
- cin >> n >> q;
- for (int t = 0; t < q; t++)
- {
- cin >> bu;
- if (bu == '+')
- {
- cin >> v1 >> v2;
- a[{v2,v1}].insert({v1, v2});
- a[{v1,v2}].insert({v2, v1});
- }
- if (bu == '-')
- {
- cin >> v1 >> v2;
- b[{v2, v1}].insert({v1, v2});
- b[{v1, v2}].insert({v2, v1});
- }
- if (bu == '?')
- {
- cin >> v1 >> v2;
- if (a[{v1,v2}].count({v1, v2}))
- {
- cout << "+\n";
- continue;
- }
- if (b[{v1, v2}].count({v1, v2}))
- {
- cout << "-\n";
- continue;
- }
- cout << "?\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement