Utilitarianism is unlikely to rescue anyone from the conundrum (unless it’s applied in the most mindless way—in which case, you might as well not think about it).
There’s an obvious social benefit to being secure against being randomly sacrificed for the benefit of others. You’re not going to be able to quantify the utility of providing everyone in society this benefit as a general social principle, and weigh the benefit of consistency on that point against the benefit of violating the principle in any given instance, any more easily than you could have decided the issue without any attempt at quantification.
If it requires a round-trip of human speech through a professor (and thus the requisition of the attention of the entire class) then you can hardly say they are given as many opportunities to test as they’d like. A person of functioning social intelligence certainly has no more than 20 such round-trips available consecutively, and less conservatively even 4 might be pushing it for many.
Give them a computer program to interact with and then you can say they have as many opportunities to test as they’d like.