slow.coder's blog

By slow.coder, history, 6 years ago, In English

In competitive programming I believe every programmer has his/her favorite books (or blogs or reading materials) from which s/he learns(or learned or is learning) a lot. According to your opinion what are the best learning materials in your CP life and you would suggest as a programmer to another programmer must to read.

Thank you. Happy Learning !!!

[Although I am not so much experienced but I have some favorites and one of them I think, "Competitive Programming 3 by Steven & Felix.]

Full text and comments »

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

By slow.coder, history, 6 years ago, In English

I've tried this and everything is fine for STAR3CAS — THE WEIRD STAIRCASE. I've used recursive dp to solve this problem but it is getting WA. What are some critical IO from your side. Help please... Thanks :)

Full text and comments »

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

By slow.coder, history, 7 years ago, In English

I'm totally new to game theory. I think this problem 847 — A Multiplication Game can be solved using minimax algorithm. But I can't design the losing position for this problem. This problem may solve by finding pattern CF post, but I want to solve this problem with the concept of game theory (minimax algorithm). Any hint(how to think about losing position) for this problem form u, programmers??? :)

Full text and comments »

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

By slow.coder, history, 8 years ago, In English

Abbreviation

Hello coders!!!

I'm new user of Ubuntu 14.04, and I have installed code blocks 13.12 on it. But I have found that Abbreviation plugin is not installed here. If you have any idea to solve this problem(How to install Abbreviation plugin?) then please help me.

Thanks in advanced!!!

Full text and comments »

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

By slow.coder, history, 8 years ago, In English

SPOJ Problem: Tiling a Grid With Dominoes

In short: You are given the value of N, now determine in how many ways you can completely tiled a 4xN rectangle with 2x1 dominoes.

We can solve this problem using DP technique, when the recurrence relation is:

f[n] = f[n - 1] + 5 * f[n - 2] + f[n - 3] - f[n - 4];

Here is a great explanation: count the ways to fill a 4×n board with dominoes. Thanks to draughtsman for providing such a wonderful tutorial link. :)

Full text and comments »

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

By slow.coder, history, 8 years ago, In English

[Here, I will list different effective tips and techniques with explanation. If you have any tips or techniques to share then you can comment(Your name will be added with problem). I will add that as a new problem. And give your explanation if you have any for unexplained problems.]

1. Problem 1 (Josephus Problem)

2. Problem 2(Tiling 4xN grid with 2x1 block)

Full text and comments »

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

By slow.coder, history, 9 years ago, In English

LuckyLand Lottery is a problem directly related to Josephus problem!!!

In short:

There are N peoples (N > 0) arranged in a loop (peoples are numbered from 1 to N) so that 1st person comes after Nth person. In each lottery round the 2nd person wins starting from random number P (0 < P <= N), then next round starts from that position where it was ended before (winners will not consider for next rounds). Given the value of N and P. You need to find the person who wins at last.

AC soln:

ans = N - 1's complement of(N) + P - 1
if(ans > N)
   ans = ans mod N

I don't know how does it work...

Have you any Explanation to describe this soln?

Full text and comments »

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

By slow.coder, history, 9 years ago, In English

UVa 10918 — Tri Tiling.

In short, You are given the value of N, now determine in how many ways you can completely tiled a 3xN rectangle with 2x1 dominoes. Here is a possible soln: Algorithmist — UVa 10918. My question is, how is the recurrence defined? Here,

********   AA*******   AA******   A*******
******** = BB******* + B******* + A*******
********   CC*******   B*******   BB******
  f(n)   =  f(n-2)   +  g(n-1)  +  g(n-1)

Isn't it possible as:

********   AA*******   AA******   AA******
******** = BB******* + BA****** + AA******
********   CC*******   BA******   BB******
  f(n)   =  f(n-2)   +  f(n-2)  +  f(n-2)

or like others....(actually I want to know it). How can I define such type of recurrence?

Actually I want to know, what type of thinking should I keep in mind while defining recurrence for Tiling Block problem???

Thanks in advanced. :)

Full text and comments »

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