Блог пользователя VandanRogheliya

Автор VandanRogheliya, история, 4 года назад, По-английски

Hello, codeforces community! This is a follow up to the blog, Competing Everyday?.

This may sound like a flex but the point is to help the Pupils and Newbies who are stuck with their rating.

I had been struggling to get to Specialist level for a half a year despite solving CP problems almost everyday. It got very frustrating to the point that I almost quit.

Fortunately, in October I got some free time and I thought to change my strategy. I noticed that my rating depends on the problems which I can solve during the contests (roughly speaking), so why do not I practice contests instead of individual problems. To further check this line of reasoning I asked the same thing in the previous blog. A couple of high rated coders shared that they used the same strategy.

As you can see in my rating graph, I went from a Newbie to an Expert now (Hopefully it stays like that XD), that too in less than a month.

The Method I used

The method is simple but surprisingly it worked for me. It can also be the case that all that practising I did for half a year was improving me but the only issue could be the speed of solving a problem. Anyways if you are not able to break 1400 mark then you can give this a shot.

That was my little experiment and I am planning to continue this further.

If you got any suggestions to improve on this method further or if I have misunderstood anything, please let me know. I hope this helps the community.

UPD

This way of practicing may not work for everyone. It worked for me that does not mean it is the best way.

I will try to answer all the question with the knowledge I have. If you are an experienced coder and can correct my replies then please do, as I am also still learning.

I was not expecting such a huge positive response, thank you all!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +177
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 4 года назад, По-английски

Title says it all, what are your thoughts on competing everyday to improve at CP? It includes all live contests on CF and AtCoder plus virtual contests on days when there are no live contests available. After the contest you either up solve or learn new concepts which came in it.

Recently I got enough time to make this possible. Should I invest my time like this or follow a roadmap which covers all DSA in a sequence (I find latter one kinda boring)?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 4 года назад, По-английски

I was solving D-Query question from SPOJ.

This was my original solution using an offline approach. Strangely for queries, more than 16 this program gave a segmentation fault

I modified the program according to one editorial to this and got AC

Note: Both programs only differ in sorting comp_ends function:

In 1st approach

int comp_ends(const Info& a, const Info& b) {
  if (a.type == b.type) {
    if (a.type == Q) return a.r <= b.r;
    return a.i <= b.i;
  } else {
    if (a.type == Q) return a.r < b.i;
    return a.i <= b.r;
  }
}

In 2nd approach

int comp_ends(const Info& a, const Info& b) {
  if (a.end < b.end) return true;
  else if (a.end == b.end) return a.type == I;
  else return false;
}

It will be very helpful if someone pointed out my mistake.

Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -10
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 4 года назад, По-английски

I was practising C. k-Tree. I want to solve it by finding the difference between f(n,k) and f(n,d-1) where f will return the number of ways to break n into a sum of integers from 1 to k.

Can someone please link the resources for an iterative solution or explain it?

Thank you!

Edit: Making it less confusing:

Example:

I want to find the number of ways to make sum n=3 from using integers 1 to k=2.

1st way: 1 + 1 + 1

2nd way: 2 + 1

3rd way: 1 + 2

So total ways are 3.

Note: I can not use only 3 because it is more than k=2. If k=3 then I can also use only 3 and get 4 ways.

I can do this by recursion like this:



ll recFun(ll k, ll n, ll sum = 0) { if (sum == n) { return 1; } else if (sum > n) return 0; ll total = 0; FO(i, k) { total += recFun(k, n, sum+i+1); } return total; }

Полный текст и комментарии »

Теги #dp
  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 5 лет назад, По-английски

I was trying to solve this question.

First I wrote this solution which got WA.

Then after checking other already AC solutions I changed the solution to this which got AC.

Both solutions look mathematically identical to me.

Can anyone please explain to me where I am wrong?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 5 лет назад, По-английски

While solving this question I came up with this solution. I was getting WA. I checked my code 5 times, I was not able to find a mistake. Then Finally I checked the editorial, it was the same dp but in an iterative form. Can someone point out the mistake?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор VandanRogheliya, история, 5 лет назад, По-английски

Sorry for this noob question, I am new to competitive coding. I want to know what in my code is causing "time limit exceeded". Link to my code

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится