Actually it seems like the optimal strategy is to cynl hagvy guvegrra pbva syvcf be hagvy gur engvb bs urnqf gb gnvyf frra fb sne vf orgjrra guerr gb bar naq bar gb guerr (which, apart from the value of N, seems intuitive enough). I checked this by brute force and computer, but maybe there is a cleaner solution.
Actually it seems like the optimal strategy is to cynl hagvy guvegrra pbva syvcf be hagvy gur engvb bs urnqf gb gnvyf frra fb sne vf orgjrra guerr gb bar naq bar gb guerr (which, apart from the value of N, seems intuitive enough). I checked this by brute force and computer, but maybe there is a cleaner solution.
That N is correct, or at least it’s what I calculated. Nice work.