QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#406614 | #6659. 외곽 순환 도로 2 | socpite | Compile Error | / | / | C++23 | 2.6kb | 2024-05-07 15:16:21 | 2024-08-26 15:52:18 |
Judging History
你现在查看的是最新测评结果
- [2024-08-26 15:52:18]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-05-07 15:16:22]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-05-07 15:16:21]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
const long long INF = 1e18;
vector<int> g[maxn];
long long dp[maxn][2][2][2];
int R[maxn];
long long w[maxn], c[maxn];
void dfs(int x, int cnt){
if(g[x].empty()){
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
for(int k = 0; k < 2; k++){
dp[x][i][j][k] = INF;
}
}
}
dp[x][0][0][0] = dp[x][1][1][1] = 0;
R[x] = ++cnt;
return;
}
for(auto v: g[x]){
dfs(v, cnt);
if(!R[x]){
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
for(int k = 0; k < 2; k++){
dp[x][i][j][k] = min(dp[v][i][j][k] + c[v], dp[v][i^1][j][k]);
}
}
}
}
else {
long long nw[2][2][2];
for(int xc = 0; xc < 2; xc++){
for(int xl = 0; xl < 2; xl++){
for(int xr = 0; xr < 2; xr++){
nw[xc][xl][xr] = INF;
}
}
}
for(int xc = 0; xc < 2; xc++){
for(int xl = 0; xl < 2; xl++){
for(int xr = 0; xr < 2; xr++){
for(int vc = 0; vc < 2; vc++){
for(int vl = 0; vl < 2; vl++){
for(int vr = 0; vr < 2; vr++){
nw[xc][xl][vr] = min(nw[xc][xl][vr], dp[x][xc][xl][xr] + dp[v][vc][vl][vr] + c[v]*(vc == xc) + w[R[x]]*(xr == vl));
}
}
}
}
}
}
for(int xc = 0; xc < 2; xc++){
for(int xl = 0; xl < 2; xl++){
for(int xr = 0; xr < 2; xr++){
dp[x][xc][xl][xr] = nw[xc][xl][xr];
}
}
}
}
R[x] = R[v];
}
}
long long place_police (vector<int> P, vector<long long> C, vector<long long> W){
for(int i = 0; i < W.size(); i++)w[i+1] = W[i];
for(int i = 0; i < P.size(); i++){
g[P[i]].push_back(i+1);
c[i+1] = C[i];
}
dfs(0);
long long ans = INF;
for(int xc = 0; xc < 2; xc++){
for(int xl = 0; xl < 2; xl++){
for(int xr = 0; xl < 2; xl++){
ans = min(ans, dp[0][xc][xl][xr] + w[R[0]]*(xl == xr));
}
}
}
return ans;
}
详细
answer.code: In function ‘long long int place_police(std::vector<int>, std::vector<long long int>, std::vector<long long int>)’: answer.code:77:8: error: too few arguments to function ‘void dfs(int, int)’ 77 | dfs(0); | ~~~^~~ answer.code:13:6: note: declared here 13 | void dfs(int x, int cnt){ | ^~~