QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#527687 | #6659. 외곽 순환 도로 2 | NianFeng | Compile Error | / | / | C++14 | 1.5kb | 2024-08-22 18:16:05 | 2024-08-22 18:16:06 |
Judging History
你现在查看的是测评时间为 2024-08-22 18:16:06 的历史记录
- [2024-08-22 18:16:06]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-08-22 18:16:05]
- 提交
answer
#include<bits/stdc++.h>
#define fr(i,j,k) for(int i=j;i<=k;++i)
#define mk make_pair
#define pil pair<int,long long>
#define ll long long
#define pb push_back
using namespace std;
const int Maxn=1e5+10;
const ll inf=1e18;
vector<pil> vc[Maxn];
ll f[Maxn][2][2][2];
ll val[Maxn],g[2][2][2];
int n,siz[Maxn];
int num;
inline void chkmin(ll &x,ll y){if(x>y) x=y;}
inline void dfs(int x){
cerr<<x<<endl;
if(vc[x].empty()){siz[x]=1;++num;f[x][1][1][1]=f[x][0][0][0]=0;return;}
int chs=0;
ll now;
for(auto p:vc[x]){
int y=p.first;ll z=p.second;dfs(y);
fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) g[i1][i2][i3]=f[x][i1][i2][i3],f[x][i1][i2][i3]=inf;
if(!chs){
fr(rt,0,1) fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) chkmin(f[x][rt][i2][i3],f[y][i1][i2][i3]+(rt==i1)*z);
++chs;
}
else {
fr(i1,0,1) fr(i2,0,1) fr(i3,0,1)
fr(j1,0,1) fr(j2,0,1) fr(j3,0,1){
chkmin(f[x][i1][i2][j3],g[i1][i2][i3]+f[y][j1][j2][j3]+(i1==j1)*z+(i3==j2)*now);
}
}now=val[num];
}
}
long long place_police(vector<int> P, vector<long long> C, vector<long long> W){
n=P.size()+1;// cerr<<n<<endl;
fr(i,2,n){
// cerr<<P[i-2]+1<<' '<<i<<endl;
vc[P[i-2]+1].pb(mk(i,C[i-2]));
}
fr(i,1,n) fr(j1,0,1) fr(j2,0,1) fr(j3,0,1) f[i][j1][j2][j3]=inf;
for(auto x:W) val[++num]=x;num=0;
dfs(1);
ll ans=inf;
fr(i1,0,1) fr(i2,0,1) fr(i3,0,1) chkmin(ans,f[1][i1][i2][i3]+(i2==i3)*val[num]);
return ans;
}
Details
cc1plus: fatal error: implementer.cpp: No such file or directory compilation terminated.