HASHCODE 2018 in sqlite3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

HASHCODE 2018 in sqlite3

Domingo Alvarez Duarte
Hello !

I've been looking ath the HASHCODE 2018 competition and got interested
on the problem proposition:

Given a list of pre-booked rides in a city and a fleet of self-driving
vehicles, assign the rides to vehicles, so
that riders get to their destinations on time.

For every ride that finishes on time (or early), you will earn points
proportional to the distance of that ride;
plus an additional bonus if the ride also started precisely on time.

It took me a while to get something working and at end I saw that I was
basically using sqlite3 capabilities to do the data manipulation tasks
and only needed a few calculations for the rest.

So I tried to see if I also could make those calculations inside sqlite3
and after a while I could get it to work:


As I stated there:

By no means I claim that solutions like this (stretching sqlite3) are
good practice. Take it as an example that demonstrates several
capabilities of sqlite3 in a hack/compact way.

So I'm showing it here just in case it can help/invite other people to
find imaginative ways where sqlite3 can be used to solve problems.

Cheers !

sqlite-users mailing list
[hidden email]