15分WA求助
查看原帖
15分WA求助
661595
a2lyaXNhbWUgbWFyaXNh楼主2022/10/7 09:33

qwq WA是我没想到的

#pragma GCC target("sse3","sse2","sse")
#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define inf 0x7ffffff
#define int unsigned long long
namespace IO{
	char ibuf[(1<<20)+1],*iS,*iT;
	#if ONLINE_JUDGE
		#define gh() (iS==iT?iT=(iS=ibuf)+fread(ibuf,1,(1<<20)+1,stdin),(iS==iT?EOF:*iS++):*iS++)
 	#else
		#define gh() getchar()
	#endif
	inline long long read(){
		reg char ch=gh();
		reg long long x=0;
		reg char t=0;
		while(ch<'0'||ch>'9')   t|=ch=='-',ch=gh();
		while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=gh();
		return t?-x:x;
	}
	inline void write(int x){
		if(x<0)
			putchar('-'),x=-x;
		if(x>9)
			write(x/10);
		putchar(x%10+'0');
	}
}using IO::read;
using IO::write;

signed n,m,t,x,y,z,a[100020];

signed main(){
	reg int ans;
	n=read();
	m=read();
	for(reg signed i=1;i<=n;++i)
		a[i]=read();
	for(reg signed i=1;i<=m;++i){
		t=read();
		if(t==1){
			short f=0;
			x=read();
			y=read();
			z=read(); 
			if(z==1)continue;
			if(z==2)f=1; 
			for(reg signed j=x;j<=y;j+=7){
				if(f){
					if(a[j]&1==0)a[j]>>=1;
					if(a[j+1]&1==0&&j+1<=y)a[j]>>=1;
					if(a[j+2]&1==0&&j+2<=y)a[j]>>=1;
					if(a[j+3]&1==0&&j+3<=y)a[j]>>=1;
					if(a[j+4]&1==0&&j+4<=y)a[j]>>=1;
					if(a[j+5]&1==0&&j+5<=y)a[j]>>=1;
					if(a[j+6]&1==0&&j+6<=y)a[j]>>=1;
				}else{
					if(a[j]%z==0)a[j]/=z;
					if(a[j+1]%z==0&&j+1<=y)a[j+1]/=z;
					if(a[j+2]%z==0&&j+2<=y)a[j+2]/=z;
					if(a[j+3]%z==0&&j+3<=y)a[j+3]/=z;
					if(a[j+4]%z==0&&j+4<=y)a[j+4]/=z;
					if(a[j+5]%z==0&&j+5<=y)a[j+5]/=z;
					if(a[j+6]%z==0&&j+6<=y)a[j+6]/=z;
				}
			}
		}else{
			ans=0;
			x=read();
			y=read();
			for(reg signed j=x;j<=y;j+=7){
				ans+=a[j];
				if(j+1<=y)ans+=a[j+1];
				if(j+2<=y)ans+=a[j+2];
				if(j+3<=y)ans+=a[j+3];
				if(j+4<=y)ans+=a[j+4];
				if(j+5<=y)ans+=a[j+5];
				if(j+6<=y)ans+=a[j+6];
			}
			printf("%llu\n",ans);
		}
	}
	return 0;
}

PS:样例都没过

2022/10/7 09:33
加载中...