Codeforces celebrates 10 years! We are pleased to announce the crowdfunding-campaign. Congratulate us by the link https://codeforces.com/10years. ×

sumit93's blog

By sumit93, 5 years ago, In English,
My code


LLI rec(int room,int col)
{
if(room==0&&col==0)
return 1;
if(room==0||col==0)
return 0;
LLI &ans=dp[room][col];
if(ans!=-1)
return ans;
ans=0;
for(LLI i=1; i<=room; i++)
{
LLI temp=nCr(room,i)%mod;
temp=(temp*rec(room-i,col-1))%mod;
ans+=temp;
ans=ans%mod;
}
return ans%mod;
}

I am using this recursive dp to solve a problem.Suppose I have 200rooms and 35 colours. Here mod=1000000007. I have to colour every room using 35 colurs and every colour must be used.My function gives me wrong output. But I think it shoul give me correct otput. if room=200 and colour=35 , my function output: 872158314. But correct output shoul be : 35727139.Can anybody explain my logical bug in my function.

Read more »

 
 
 
 
  • Vote: I like it
  • -11
  • Vote: I do not like it

By sumit93, 5 years ago, In English,

Given two number N,M.Count the number of pair(i,j) such that LCM(i,j)=i*j.Here M,N<=10^9 and min(M,N)=10^6. How can I do this?

Read more »

 
 
 
 
  • Vote: I like it
  • +6
  • Vote: I do not like it

By sumit93, 5 years ago, In English,

I have n two dimensional points and some rectangle.For each rectangle I have to answer how much point is inside of that rectangle? How can I answer this with complexity log(n)?

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

By sumit93, 6 years ago, In English,
 
 
 
 
  • Vote: I like it
  • -36
  • Vote: I do not like it

By sumit93, 7 years ago, In English,

Give me some idea to learn bitmask dp.

Read more »

 
 
 
 
  • Vote: I like it
  • -10
  • Vote: I do not like it

By sumit93, 7 years ago, In English,
 
 
 
 
  • Vote: I like it
  • -19
  • Vote: I do not like it