In the absence of repeated values (ties), the cdf can be obtained computationally by sorting the observed data in ascending order, i.e., . Then , where represents the ascending rank of . Likewise, the p-value can be obtaining by sorting the data in descending order, and using a similar formula, , where represents the descending rank of .
https://brainder.org/2012/11/28/competition-ranking-and-empirical-distributions/