-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1032.cpp
More file actions
38 lines (38 loc) · 796 Bytes
/
1032.cpp
File metadata and controls
38 lines (38 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int _N = 1e5 + 10, _p = 1e9 + 7;
int N, M, K, t, a, b, id;
ll r[_N];
main(void) {
cin.tie(0);
ios_base::sync_with_stdio(0);
cin >> N >> M;
while (M--) {
cin >> t;
switch (t) {
int val;
case 0:
cin >> a >> b;
val = (a * 1ll * 100000 + b * 1ll) % _p;
if (a > b) swap(a, b);
r[a] += val, r[b] -= val;
break;
case 1:
cin >> a >> b;
val = (a * 1ll * 100000 + b * 1ll) % _p;
if (a > b) swap(a, b);
r[a] -= val, r[b] += val;
break;
case 2:
cin >> K;
ll sum = 0;
while (K--) {
cin >> id;
sum += r[id];
}
cout << (!sum) << '\n';
}
}
return 0;
}