algorithm 1: direct p-value