Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
121056 陈道宁 幽灵粒子 C++ 通过 100 1 MS 272 KB 498 2024-01-21 15:02:21

Tests(10/10):


#include<bits/stdc++.h> using namespace std; int x[5005]; int b[5005]; int n,l; int main(){ int max,min=0,max2=0; cin>>n>>l; max=l+1; for(int i=0;i<n;i++){ cin>>x[i]; int temp; if(x[i]<max){ max=x[i]; } if(x[i]>max2){ max2=x[i]; } if(l+1-x[i]>l+1-(l+1-x[i])){ temp=l+1-(l+1-x[i]); } else{ temp=l+1-x[i]; } if(min<temp){ min=temp; } } cout<<min<<" "; if((l+1-max)>max2){ cout<<l+1-max; } else{ cout<<max2; } }


测评信息: