90pts,#16 #17 WA 求助

P3622 [APIO2007] 动物园

~~虽然在洛谷发帖求助一般没什么用,不过我真的没别的办法了~~
by 伊莉雅丝菲尔 @ 2021-07-07 14:27:01


```cpp /************************************************************************* > File Name: p3622.cpp > Author: Typedef > Mail: [email protected] > Created Time: 2021年07月07日 星期三 07时37分52秒 > Tags: ************************************************************************/ //这是 @[typedef](/user/113926) 的小号,可能会与大号提交重复代码,希望管理员手下留情 QAQ #include<bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; const int N=5e4+4,M=57,S1=(1<<4)-1; int n,C,S=1<<5; int f[N][M],g[N][M]; int main(){ scanf("%d%d",&n,&C); for(int i=1;i<=C;i++){ int a,b,c,x,t1=0,t2=0; scanf("%d%d%d",&a,&b,&c); for(int j=1;j<=b;j++) scanf("%d",&x),x=(x-a+n)%n,t1|=1<<x; for(int j=1;j<=c;j++) scanf("%d",&x),x=(x-a+n)%n,t2|=1<<x; for(int j=0;j<S;j++) if((j&t1)||(~j&t2)) g[a][j]++; } int ans=0; for(int j=0;j<S;j++) f[0][j]=-INF; for(int i=0;i<S;i++){ f[0][max(i-1,0)]=-INF; f[0][i]=0; for(int j=1;j<=n;j++) for(int s=0;s<S;s++) f[j][s]=max(f[j-1][(s&S1)<<1],f[j-1][(s&S1)<<1|1])+g[j][s]; if(ans<f[n][i]) ans=f[n][i]; } printf("%d\n",ans); return 0; } ``` 问题已解决,错因是初始化没初始化全 ~~这就是学术网站吗爱了爱了~~ 果然调题还得靠自己
by 伊莉雅丝菲尔 @ 2021-07-07 14:43:39


![/kk](https://cdn.luogu.com.cn/upload/pic/62227.png)
by typedef @ 2021-07-07 15:12:14


|