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.
#include <bits/stdc++.h>
using namespace std; #define mod 1000000007 #define ll long long int
int main() {
// your code goes here
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??
You just had to work your way around bits and calculate your answer accordingly.
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.