kth-competitive-programming / kactl

KTH Algorithm Competition Template Library (... eller KTHs AC-tillverkande lapp)
2.72k stars 736 forks source link

Runtime Error with Convexhull.h #271

Open DeMen100ns opened 1 month ago

DeMen100ns commented 1 month ago

Recently, i use the Convexhull.h to submit problem 2195 on CSES. It passed almost of tests, except one test:

4
3 2
1 5
3 6
3 5

the judge returned error:

code: malloc.c:2617: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

Here is link of my implementation: Link

I have ran the test in local and it returned the correct answer.

bjorn-martinsson commented 1 month ago

I just took a quick glance, but you have clearly modified the code from ConvexHull.h.

h[t-2].cross(h[t-1], p) < 0

vs

h[t-2].cross(h[t-1], p) <= 0