Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор K0DEL, история, 20 месяцев назад, По-английски

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; }

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

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

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

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.

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

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