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

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

I would like to invite you to participate in the online mirror of the Croatian Olympiad in Informatics which is held this Saturday.

The problemset will consist of 3-5 IOI stlye tasks and you will have 5 hours to solve them. The expected difficulty is greater than usual COCI rounds, but lesser than IOI.

Click here to see where the coding begins in your timezone.

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

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

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

Join us this Saturday on the 7th round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

Everyone has had a bug in their code because of accessing out of array bounds. However, in some cases, the program will run as expected.

I have two examples from today's contest: problem B — 24829988 problem C — 24831518

In both of these problems, I had stupid bugs. For problem B, it's possible that the argument k of the function is zero and this line

if (ind == f[k-1]) return (int) (n % 2)

will access f[ - 1] which is undefined.

I have found this bug, and after some stress testing locally and on CodeForces, I decided not to resubmit because it seemed fine.

Now, in problem C, I iterated up to 1029 and the value of i xor x can become larger than the size of the array. However, this is only an issue if that piece of memory is not used by the process and it will result in seg fault.

Otherwise, nothing will be changed because we add zero.

I only found this bug while I was trying to hack someone else's solution so I couldn't resubmit and I was pretty sure it was going to fail system tests because locally it resulted in seg fault for some cases.

To my surprise, both submissions were actually successful, and my F failed (but that's irrelevant to this post xD) My question is this: what do you usually do when you find a bug like this during the contest and do you stress test your solutions before submitting to prevent it?

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

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

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

Join us today on the 6th round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

Join us this Saturday on the 5th round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

Join us today on the 3rd round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

Join us this Saturday on the 2nd round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

Join us this Saturday on the 1st round of this year's COCI!

Click to see where the coding begins in your timezone.

We can discuss the problems here after the contest.

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

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

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

I encountered an unusual runtime error during today's Div 2 round on problem D. http://mirror.codeforces.com/contest/706/problem/D

I implemented a simple trie, and received runtime error on test 1. http://mirror.codeforces.com/contest/706/submission/19803196

After some more submissions, I got to this: http://mirror.codeforces.com/contest/706/submission/19805829

With a couple of custom invocations, I narrowed the problem down to function mx. Implementing it a bit differently, I got AC. http://mirror.codeforces.com/contest/706/submission/19808959

After the contest, I tried submiting my code to several other sites: SPOJ, UVa, ideone. I also ran the code locally both on Windows and Linux. Out of all of these, CodeForces was the only platform on which the program crashed.

Is there a bug in the compiler, or am I missing something?

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

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