版本比较
P15289 「YLLOI-R3-T4」止战之殇
正文
增加 2 行删除 2 行
34 行未改动353637383939404142434445464748484950515219 行未改动34 行未改动 if(a[i]) ans=max(ans,f[i]=max(f[i-1],f[i-2])+a[i]); return ans;}inline ll L(int x){ ll ans=1;a[x]--; ll ans=1,sum=R(x);a[x]--; while(1) if(x>2&&a[x-1]==1&&a[x-2]==1) a[x-2]--,ans++,x-=2; else if(x>2&&a[x-2]>1) a[x-2]--,ans++,x-=2; else if(x>1&&a[x-1]>1) a[x-1]--,ans++,x--; else break; ll sum=ans+R(x); sum=max(sum,ans+R(x)); if(x>1&&a[x-1]){a[x-1]--;sum=max(sum,ans+1+R(x-1));a[x-1]++;} if(x>2&&a[x-2]){a[x-2]--;sum=max(sum,ans+1+R(x-2));a[x-2]++;} return sum;}19 行未改动