提交时间:2024-01-21 15:27:12

运行 ID: 121134

#include<bits/stdc++.h> using namespace std; int main(){ int n,l,Max=0,Min=0; scanf("%d%d",&n,&l); for(int i=1,temp;i<=n;i++){ scanf("%d",&temp); Max=max(Max,max(l-temp+1,temp)); Min=max(Min,min(l-temp+1,temp)); } cout << Max << " " << Min; return 0; }