# January Cook-Off 2020 Post-Contest Discussion Stream

I will be streaming a discussion of the problems in Cook-Off right after the contest ends. I will go over most of the problems in div 2 and the ones in div 1 that I’m able to solve. I will also try my best to answer questions that arise during the discussion. Please note that I won’t answer general questions like “how to become good at cp” (at least not during the stream).

The link will be posted below about 5 minutes after the contest ends and I will start discussing 5 minutes after that.

Edit:

I have reuploaded the stream so anyone can view it later. Also, I have included timestamps in the description so you can skip to the specific problem directly. I was more tired than expected at 3am so my explanations weren’t always the best, but I’ll keep trying to improve.

43 Likes

10 Likes

i didn’t get the concept of RangeAND …could someone direct me to a similar question or the main idea of thinking behind this?

For RGAND

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
int main() {
int t;
cin>>t;
while(t–)
{
ll l,r;
cin>>l>>r;
if(r<l*2)
cout<<(((r - l) * l + l )%mod)<<endl;
else
cout<<((l * l)%mod)<<endl;
}
return 0;
}
Which case it is not satisfying??

Also about the main idea behind this question was that prefix AND arrays are always non-increasing in nature. Also once bits are unset they are never set again in prefix AND arrays. These properties sparked a solution in my head.

3 Likes

1
3 4

3 Likes

@tmwilliamlin
I was going through your code for “Almost Palindromic” (PLIND)

dp[i][j]: number of numbers of length i with j digits occuring odd times

However, you set the base case as

dp[0][0]=1 and dp[0][1]=1

This computes dp[1][0] = 10 and dp[1][1] = 1
Ideally, shouldn’t the values of dp[1][0] equal 0 and that of dp[1][1] equal 10 as per the definition

Sorry, I was tired and didn’t explain the DP correctly.

dp[i][j]: number of ways to choose suffix of length i such that the prefix has j digits occurring an odd number of times

2 Likes