QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527651 | #6659. 외곽 순환 도로 2 | NianFeng | Compile Error | / | / | C++14 | 1.4kb | 2024-08-22 18:02:15 | 2024-08-26 15:53:23 |
Judging History
你现在查看的是最新测评结果
- [2024-08-26 15:53:23]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-08-22 18:02:15]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-08-22 18:02:15]
- 提交
answer
const int N=100100;
vector<int>G[N];
vector<long long>c,w;
int v,h[N];
long long f[N][2][2][2],g[2][2][2],ans;
void dfs(int x){
if(G[x].empty()){
f[x][0][0][0]=f[x][1][1][1]=0;
return h[x]=++v,void();
}
for(int y : G[x]){
dfs(y);
if(!h[x])
for(int i=0;i<=1;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++)
f[x][i][j][k]=max(f[y][i^1][j][k]+c[y-1],f[y][i][j][k]);
else{
for(int i=0;i<=1;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++)
g[i][j][k]=-1e18;
for(int i=0;i<=1;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++)
for(int a=0;a<=1;a++) for(int b=0;b<=1;b++) for(int z=0;z<=1;z++)
g[i][j][k]=max(g[i][j][k],f[x][i][j][a]+f[y][z][b][k]+c[y-1]*(i^z)+w[h[x]-1]*(a^b));
for(int i=0;i<=1;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++)
f[x][i][j][k]=g[i][j][k];
} h[x]=h[y];
}
}
long long place_police(vector<int> P, vector<long long> C, vector<long long> W){
for(int i=0;i<P.size();i++)
G[P[i]].push_back(i+1);
memset(f,0xcf,sizeof(f));
c=C,w=W,dfs(0),ans=-1e18;
for(int i=0;i<=1;i++) for(int j=0;j<=1;j++) for(int k=0;k<=1;k++)
ans=max(ans,f[0][i][j][k]+W.back()*(j^k)); ans=-ans;
for(long long x : C) ans+=x; for(long long x : W) ans+=x;
return ans;
}
Details
answer.code:2:1: error: ‘vector’ does not name a type 2 | vector<int>G[N]; | ^~~~~~ answer.code:3:1: error: ‘vector’ does not name a type 3 | vector<long long>c,w; | ^~~~~~ answer.code: In function ‘void dfs(int)’: answer.code:7:8: error: ‘G’ was not declared in this scope 7 | if(G[x].empty()){ | ^ answer.code:11:17: error: ‘G’ was not declared in this scope 11 | for(int y : G[x]){ | ^ answer.code:15:51: error: ‘c’ was not declared in this scope 15 | f[x][i][j][k]=max(f[y][i^1][j][k]+c[y-1],f[y][i][j][k]); | ^ answer.code:15:31: error: ‘max’ was not declared in this scope 15 | f[x][i][j][k]=max(f[y][i^1][j][k]+c[y-1],f[y][i][j][k]); | ^~~ answer.code:21:71: error: ‘c’ was not declared in this scope 21 | g[i][j][k]=max(g[i][j][k],f[x][i][j][a]+f[y][z][b][k]+c[y-1]*(i^z)+w[h[x]-1]*(a^b)); | ^ answer.code:21:84: error: ‘w’ was not declared in this scope 21 | g[i][j][k]=max(g[i][j][k],f[x][i][j][a]+f[y][z][b][k]+c[y-1]*(i^z)+w[h[x]-1]*(a^b)); | ^ answer.code:21:28: error: ‘max’ was not declared in this scope 21 | g[i][j][k]=max(g[i][j][k],f[x][i][j][a]+f[y][z][b][k]+c[y-1]*(i^z)+w[h[x]-1]*(a^b)); | ^~~ answer.code: At global scope: answer.code:27:24: error: ‘vector’ was not declared in this scope 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~~~~ answer.code:27:31: error: expected primary-expression before ‘int’ 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~ answer.code:27:39: error: ‘vector’ was not declared in this scope 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~~~~ answer.code:27:46: error: expected primary-expression before ‘long’ 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~~ answer.code:27:60: error: ‘vector’ was not declared in this scope 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~~~~ answer.code:27:67: error: expected primary-expression before ‘long’ 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^~~~ answer.code:27:79: error: expression list treated as compound expression in initializer [-fpermissive] 27 | long long place_police(vector<int> P, vector<long long> C, vector<long long> W){ | ^