For any k=1,2,…,m, assuming there are xk students failing to answer the kth question correctly, then there are n−xk ones who answer it correctly and each gets xk marks from it accordingly. Suppose the sum of the n students' total marks is S. Then we have
i=1∑npi=S=k=1∑mxk(n−xk)=nk=1∑mxk−k=1∑mxk2.
As each student gets at most xk marks from the kth question, we have
p1≤∑k=1mxk.
Since p2≥⋯≥pn, then pn≤n−1p2+p3+⋯+pn=n−1S−p1.
Therefore,
p1+pn≤p1+n−1S−p1=n−1n−2p1+n−1S≤n−1n−2⋅k=1∑mxk+n−11⋅(nk=1∑mxk−k=1∑mxk2)=2k=1∑mxk−n−11⋅k=1∑mxk2.
By the Cauchy Inequality, we have
k=1∑mxk2≥m1(k=1∑mxk)2.
Then
p1+pn≤2k=1∑mxk−m(n−1)1⋅(k=1∑mxk)2=−m(n−1)1⋅(k=1∑mxk−m(n−1))2+m(n−1)≤m(n−1).
On the other hand, if there is a student who answers all the questions correctly, while the other n−1 students fail to answer any questions, then we have
p1+pn=p1=k=1∑m(n−1)=m(n−1).
Therefore, the maximum possible value of p1+pn is m(n−1).