#include <bits/stdc++.h>
using namespace std;
#define int long long
int n, M;
vector<int> p, a;
vector<vector<int>> ch;
vector<int> conv(vector<signed> v) {
vector<int> ans(n);
for (int i = 0; i < n; i++) ans[i] = v[i];
return ans;
}
void init(signed n_, signed M_, vector<signed> p_, vector<signed> a_) {
n = n_, M = M_, p = conv(p_), a = conv(a_);
ch.resize(n + M);
for (int i = 1; i < n + M; i++) {
ch[p[i]].push_back(i);
}
}
int count_ways(signed l, signed r) {
for (int i = l; i <= r; i++) {
a[i] = !a[i];
}
vector<int> on(n + M), off(n + M);
for (int i = n; i < n + M; i++) {
if (a[i]) on[i] = 1;
else off[i] = 1;
}
for (int i = n - 1; i >= 0; i--) {
if (ch[i].size() == 1) {
on[i] = on[ch[i][0]];
off[i] = off[ch[i][0]];
} else {
int x1 = on[ch[i][0]], y1 = off[ch[i][0]], x2 = on[ch[i][1]], y2 = off[ch[i][1]];
on[i] = (2 * x1 * x2 + x1 * y2 + y1 * x2) % 1000002022;
off[i] = (2 * y1 * y2 + x1 * y2 + y1 * x2) % 1000002022;
}
}
return on[0];
}
#ifndef ONLINE_JUDGE
signed main() {
}
#endif
Compilation message
/usr/bin/ld: /tmp/cctWpzHQ.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccn1ZnxR.o:circuit.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status