K0DEL's blog

By K0DEL, history, 23 months ago, In English

I was trying to solve this problem: 1559D1 - Mocha and Diana (Easy Version)

I used the editorial solution for this and just made a small change instead of recursively finding the parent of the node I used an iterative way and it took a lot of time and I want to know why this is happening. The recursive way took 15ms while the iterative way took 764ms.

The editorial submission with recursive method: 189082733 The same submission with iterative method: 189082883

The only difference between the 2 submissions is "getf()" function.

for the recursive approach: int getf(int id, int x){return x == f[id][x] ? x : f[id][x] = getf(id, f[id][x]);}

for the iterative approach: int getf(int id, int x) { while (x != f[id][x]) x = f[id][x]; return x; }

Full text and comments »

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

By K0DEL, history, 3 years ago, In English

Codeforces Round 737 (Div. 2) 1557B - Moamen and k-subarrays

I participated in the codeforces round #738 my solution passed the all the pretests but even after the contest was over my solution did not update to wrong answer or accepted. It is continuously showing pretest passed(4) even after the system testing was over

This is the solution i submitted while the contest was going on 125370246

I submitted the same solution after the contest which got accepted. 125406123

I just want to know why is it happening. I request the admin to correct this as soon as possible.

MikeMirzayanov

Edit : The issue is now resolved . Thank you Team Codeforces.

Full text and comments »

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