找到hack,求调
查看原帖
找到hack,求调
822439
lhz2022楼主2024/10/29 21:56
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define debug() puts("I WILL AK")
#define N 100007
int T,n,m,L,V,d[N],v[N],a[N],p[N];
int vis[N];
struct node{
	int l,r;
	bool operator<(const node &b) const{
		return r<b.r||(r==b.r&&l<b.l);
	}
}pt[N];
inline void out(node k){
	//cout<<k.l<<' '<<k.r<<'\n';
}
signed main(){
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	cin>>T;
	while(T--){
		memset(vis,0,sizeof(vis));
		int cnt=0;
		cin>>n>>m>>L>>V;
		for(int i=1;i<=n;++i){
			cin>>d[i]>>v[i]>>a[i];
		}
		for(int i=1;i<=m;++i){
			cin>>p[i];
		}
		for(int i=1;i<=n;++i){
			if(a[i]==0){
				if(v[i]>V){
					if(d[i]<=p[m]){
						pt[++cnt]={d[i],L+1};
						out(pt[cnt]);
					}
				}
			}
			else if(a[i]>0){
				int bg=max(d[i]+(V*V-v[i]*v[i]+2*a[i]-1)/(2*a[i]),d[i]);
				if(bg<=p[m]){
					pt[++cnt]={bg,L+1};
					out(pt[cnt]);
				}
			}
			else{
				if(v[i]>V){
					int ed=min(L+1,d[i]+(V*V-v[i]*v[i]+2*a[i]-1)/(2*a[i])-2);
					int la=lower_bound(p+1,p+m+1,d[i])-p;
					int ra=upper_bound(p+1,p+m+1,ed)-p-1;
					if(la<=ra) pt[++cnt]={d[i],ed},out(pt[cnt]);
				}
			}
		}
		cout<<cnt<<' ';
		sort(pt+1,pt+cnt+1);
		int ans=0,idx=-2e9;
		for(int i=1;i<=cnt;++i){
			if(pt[i].l>idx){
				idx=pt[i].r;
				++ans;
			}
		}
		cout<<m-ans<<'\n';
	}
	return 0;
}

hack:

1
1 1 133 3
2 113 -113
3
2024/10/29 21:56
加载中...