求hack数据
查看原帖
求hack数据
1285357
jinminghao楼主2025/6/29 17:08

rt.

本人的代码样例AC,但交上去却是满江红,求大佬提供hack数据

谢谢

代码:

#include<cstdio>
using namespace std;
typedef long long LL;
const int N=1e5+10;
int c[N],n,T;
LL a[N],m;
int main(){
	scanf("%d",&T);
	while(T--){
		LL ans=0,cnt=0;
		scanf("%d%lld",&n,&m);
		for(int i=1;i<=n;i++){
			scanf("%lld",&a[i]);
			c[i]=0;
			LL t=a[i];
			if(m/a[i]>a[i]){
				c[i]=1;
				t=m/a[i];
			}
			if(c[i]==1){
				if(m/(m/a[i])>m/a[i]){
					c[i]=2;
					t=m/(m/a[i]);
				}
			}
			if(c[i]==0){
				if(m/(m/a[i])>a[i]){
					c[i]=2;
					t=m/(m/a[i]);
				}
			}
			ans+=t;
		}
		for(int i=1;i<=n;i++){
			if(c[i]==0&&c[i-1]==2) c[i]=2; 
		}
		for(int i=n;i>=1;i--){
			if(c[i]==0&&c[i+1]==2) c[i]=2;
		}
		int pre=1;
		for(int i=1;i<=n;i++){
			if(!c[i]){
				if(pre!=i) cnt++;
				pre=i+1;
			}
		}
		if(pre<n) cnt++;
		pre=1;
		for(int i=1;i<=n;i++){
			if(c[i]<2){
				if(pre!=i) cnt++;
				pre=i+1;
			}
		}
		if(pre<n) cnt++;
		printf("%lld %lld\n",ans,cnt);
	}
	return 0;
}
2025/6/29 17:08
加载中...