|
||||||||||
pog loves szh IITime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3427 Accepted Submission(s): 949 Problem Description Pog and Szh are playing games.There is a sequence with $n$ numbers, Pog will choose a number A from the sequence. Szh will choose an another number named B from the rest in the sequence. Then the score will be $(A+B)$ mod $p$.They hope to get the largest score.And what is the largest score? Input Several groups of data (no more than $5$ groups,$n \geq 1000$). For each case: The following line contains two integers,$n(2 \leq n \leq 100000)$£¬$p(1 \leq p \leq 2^{31}-1)$¡£ The following line contains $n$ integers $a_i(0 \leq a_i \leq 2^{31}-1)$¡£ Output For each case,output an integer means the largest score. Sample Input
Sample Output
Source | ||||||||||
|