shpvb's blog

By shpvb, history, 5 years ago, In English

[Edit: Issue resolved, the issue was regarding the bytes taken by size_t on different platforms]

Going through some blogs regarding the cause of the difference in output between judge and local terminal, I saw majorly the Out of Bound error. But I have looked across my code multiple times, not able to find the generation of such an exception.

Problem: 1335E1 - Палиндром из трех блоков (простая версия). My submission: 79635901

For test case 1, the output is different,

Participant's output: 6 2 3 0 0 2

Output on the local machine: 7 2 4 1 1 3

I suspect the error may lie somewhere in the implementation of sets. Please help me through if anyone catches the issue. Cheers.

Full text and comments »

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

By shpvb, history, 5 years ago, In English

I looked for it and got a source: Link

But this method may not work when the denominator is a multiple of modulus.

For example, (8/8) % 4 should be 1, but applying this approach it gets gcd(4, 8) = 4 and hence find ((8/4)/(8/4))%(4/4) which results in 0.

Similarly for (80/8) % 4 should be 2 but this results in 0.

So what can be a generalized approach towards this?

Full text and comments »

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