90 wa on#10
  • 板块P2390 地标访问
  • 楼主stylus
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/12/7 19:00
  • 上次更新2024/12/7 21:46:08
查看原帖
90 wa on#10
836448
stylus楼主2024/12/7 19:00

详见屎山

#include<bits/stdc++.h>
#define int long long
using namespace std;
void read(int &x){
	x=0;bool f=0;char ch=getchar();
	while(ch>'9'||ch<'0'){
		if(ch=='-')f=1;
		ch=getchar();
	}do{x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}while(ch>='0'&&ch<='9');
	x=f?-x:x;
}
int n,t,a[50001],s,b;
signed main(){
	read(t),read(n);
	for(int i=1;i<=n;i++)read(a[i]);
	sort(a+1,a+1+n),s=lower_bound(a+1,a+1+n,0)-a;
	for(int i=s;i<=n&&a[i]<=t;i++){
		int j=max(0ll,t-a[i]*2);
		b=max(b,i-(lower_bound(a+1,a+1+n,-j)-a)+1);
	}for(int i=1;i<s&&-a[i]<=t;i++){
		int j=max(0ll,t+a[i]*2);
		b=max(b,(lower_bound(a+1,a+1+n,j)-a)-i);
	}cout<<b;
	return 0;
}
2024/12/7 19:00
加载中...