QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#307586 | #6659. 외곽 순환 도로 2 | hjl666 | Compile Error | / | / | C++14 | 1.9kb | 2024-01-18 20:47:36 | 2024-01-18 20:47:37 |
Judging History
你现在查看的是测评时间为 2024-01-18 20:47:37 的历史记录
- [2024-08-26 15:51:57]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-01-18 20:47:37]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-01-18 20:47:36]
- 提交
answer
#include<bits/stdc++.h>
#define db double
// #define int ll
#define ll long long
#define ull unsigned long long
#define pb emplace_back
#define MP make_pair
#define pii pair<int, ll>
#define vec vector<int>
#define fi first
#define se second
#define ls k<<1
#define rs k<<1|1
#define CLK (double)clock()/(double)CLOCKS_PER_SEC
using namespace std;
mt19937 rnd(time(0));
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>9)write(x/10);
putchar(x%10+'0');
}
const int N=1e5+5;
int n,fa[N],leaf,L[N],R[N],Dfn;
ll f[N][2][2][2],g[2][2][2],val[N],circ[N];vector<pii> G[N];
void chkmin(ll &x,ll y){x=min(x,y);}
void dfs(int x,int fa){
f[x][0][0][0]=f[x][1][1][1]=0;
if(G[x].empty()){
L[x]=R[x]=++Dfn;
return ;
}
int son=0;
for(auto [y,w]:G[x]){
dfs(y,x);son++;
memcpy(g,f[x],sizeof g),memset(f[x],0x3f,sizeof f[x]);
for(int a=0;a<2;a++)for(int b=0;b<2;b++)for(int c=0;c<2;c++)
for(int i=0;i<2;i++)for(int j=0;j<2;j++)for(int k=0;k<2;k++){
if(son==1){
ll val=g[a][b][c]+f[y][i][j][k];
if(c==j)val+=circ[R[x]];
if(a==i)val+=w;
chkmin(f[x][a][j][k],val);
continue;
}
ll val=g[a][b][c]+f[y][i][j][k];
if(c==j)val+=circ[R[x]];
if(a==i)val+=w;
chkmin(f[x][a][b][k],val);//cerr<<x<<' '<<f[x][a][l][r]<<"\n";
}
if(!L[x])L[x]=L[y];R[x]=R[y];
// cout<<x<<' '<<y<<"\n";
// for(int a=0;a<2;a++)for(int b=0;b<2;b++)for(int c=0;c<2;c++)cout<<a<<' '<<b<<' '<<c<<' '<<f[x][a][b][c]<<"\n";
}
// cerr<<x<<' '<<L[x]<<' '<<R[x]<<"\n";
}
Details
cc1plus: fatal error: implementer.cpp: No such file or directory compilation terminated. answer.code: In function ‘void dfs(int, int)’: answer.code:40:14: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 40 | for(auto [y,w]:G[x]){ | ^