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

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

Hello, I was solving golf from JOI 2017 Open. I tested in polygon with author's solution. My solution got WA, then I decided to change C++17 to C++14 and magically I've got AC. Can someone tell me how is that possible. Also I submitted it to oj.uz where compiler is under Ubuntu and it also gives wrong answer code test

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

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I changed links to array, still doesn't work. code

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +28 Проголосовать: не нравится

Undefined behaviour or bug in g++. It's so obvious.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is 10 the correct answer to test?

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

If someone was wondering what was the problem. I found bug, actually in Windows C++14 and earlier when you access element of map, it creates if wasn't firstly. I was using it to compress values on lines 216-217. So in Windows elements started from 0, and in Linux from -1.