Which one got it right?

In my opinion, they're both the same.

Hyun Bin is a far better actor than the other leads though.

Both are bad. W was just a boring modern romantic cliche fairy tale. It had an interesting premise, but every other aspect of the show was so shallow and the story was overextended.

Alhambra is mostly the same. It has a very cool premise and technically it's a fantastic effort regarding sound and visuals, but the story drags too much, characters are not compelling and the romance aspect is absolutely unnecessary.

I do agree that the main lead is probably better than in W. And while W was dropped by me after few episodes, i at least want to see where the plot takes Alhambra. So i guess Alhambra is a bit better in my opinion.

If there is a need for some entertaining sci-fi/fantasy drama with a bit of romance, there is an older japanese drama Ando Lloyd. It's pretty cheesy and ridiculous, but it's much better paced and doesn't even try to mask its shortcomings, but mainly focuses on fun and action spectacle.
https://mydramalist.com/7942-ando-lloyd-a.i.-knows-love-

Memories of the Alhambra to me was like watching a fail video-game plot having a live action (or sort of). The only thing I always got myself doing was changing the channel. In the other hand, W was a big hit and well played. Nothing against any actors, productions etc, just didn't work in my point of view nor got my interest at all.