如果后两个超时且你不想用分治,不妨试试O2优化
部分sort代码:
for(int i=0;i<n;i++) scanf("%lld",&a[i]); sort(a,a+n); printf("%lld",a[k]);