大佬求助!!!P1007
  • 板块灌水区
  • 楼主Chen_2011
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/4/27 19:46
  • 上次更新2024/4/27 21:32:41
查看原帖
大佬求助!!!P1007
865781
Chen_2011楼主2024/4/27 19:46
#include<bits/stdc++.h>
using namespace std;
const int size = 5005;
int a[size];
int main(){
    int L,N;
    cin>>L>>N;
    if(!N){
        cout<<"0 0"<<endl;
        return 0;
    }for(int i=1;i<=N;i++) cin>>a[i];
    sort(a+1,a+N+1);
    int max_time,min_time;
    for (int i=1;i<=N;i++)
        min_time=max(min(a[i],L+1-a[i]),min_time);
    max_time=max(L+1-a[1],a[N]);
    cout<<min_time<<' '<<max_time<<endl;
    return 0;
}

本蒟蒻调了好久还是10分,望大佬救助

2024/4/27 19:46
加载中...