QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#792688 | #4564. Digital Circuit | _8_8_# | Compile Error | / | / | C++20 | 1.3kb | 2024-11-29 13:00:37 | 2024-11-29 13:00:37 |
Judging History
This is the latest submission verdict.
- [2024-11-29 13:00:37]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-11-29 13:00:37]
- Submitted
answer
#include "circuit.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int N = (int)1e5 + 12, MOD = 1000002022;
int n, m, f, a[N];
vector<ll> g[N], dp[N], tdp[N];
void add(int &x, int y) {
x += y;
x %= MOD;
}
ll pd[N][2];
void dfs(int v) {
if(v >= n) {
pd[v][a[v]] = 1;
pd[v][1 - a[v]] = 0;
return;
}
for(int to : g[v]) {
dfs(to);
}
pd[v][0] = ((pd[g[v][0]][0] * pd[g[v][1]][0]) % MOD * 2ll % MOD + pd[x][0] * pd[y][1] % MOD + pd[x][1] * pd[y][0] % MOD) % MOD;
int x = g[v][0], y = g[v][1];
pd[v][1] = (pd[x][0] * pd[y][1] % MOD + pd[x][1] * pd[y][0] % MOD + pd[x][1] * pd[y][1] % MOD * 2ll % MOD) % MOD;
}
void init(int32_t NN, int32_t MM, std::vector<int32_t> P, std::vector<int32_t> A) {
n = NN;
m = MM;
f = n + m;
for(int i = n; i < f; i++) {
a[i] = A[i - n];
}
for(int i = 1; i < f; i++) {
g[P[i]].push_back(i);
}
for(int i = 0; i < f; i++) {
dp[i].resize((int)g[i].size() + 1);
tdp[i].resize((int)g[i].size() + 1);
}
}
int32_t count_ways(int32_t L, int32_t R) {
if(n > 1000) return 0;
for(int i = L; i <= R; i++) {
a[i] ^= 1;
}
dfs(0);
assert(pd[0][1] >= 0);
return pd[0][1];
}
详细
answer.code: In function ‘void dfs(ll)’: answer.code:26:74: error: ‘x’ was not declared in this scope 26 | pd[v][0] = ((pd[g[v][0]][0] * pd[g[v][1]][0]) % MOD * 2ll % MOD + pd[x][0] * pd[y][1] % MOD + pd[x][1] * pd[y][0] % MOD) % MOD; | ^ answer.code:26:85: error: ‘y’ was not declared in this scope 26 | pd[v][0] = ((pd[g[v][0]][0] * pd[g[v][1]][0]) % MOD * 2ll % MOD + pd[x][0] * pd[y][1] % MOD + pd[x][1] * pd[y][0] % MOD) % MOD; | ^