| 比赛 |
期末考试0 |
评测结果 |
ATTTTTTTTT |
| 题目名称 |
我能在摸鱼被发现的情况下躲避教练的视奸吗 |
最终得分 |
10 |
| 用户昵称 |
PXCZM |
运行时间 |
27.927 s |
| 代码语言 |
C++ |
内存使用 |
12.77 MiB |
| 提交时间 |
2026-02-07 11:40:47 |
显示代码纯文本
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll mod=((ll)1<<32);
const int MAXSIZE=(1<<25);
char buf[1<<25],*p1,*p2;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXSIZE,stdin),p1==p2)?EOF:*p1++)
inline int read(){
int x=0,f=1;char ch=gc();
while(!isdigit(ch)){if(ch=='-')f=-1;ch=gc();}
while(isdigit(ch))x=(x<<3)+(x<<1)+ch-48,ch=gc();
return x*f;
}
int n,m;
int a[500010],b[500010],c[500010];
int gcd(int x,int y)
{
if(x<y) swap(x,y);
if(y==0) return x;
else return gcd(y,x%y);
}
int main()
{
freopen("shijian.in","r",stdin);
freopen("shijian.out","w",stdout);
n=read();m=read();
for(int i=1;i<=n;i++) a[i]=read();
for(int i=1;i<=n;i++) b[i]=read();
for(int i=1;i<=n;i++) c[i]=read();
for(int t=1;t<=m;t++)
{
int l=read(),r=read();
ll ans=0;
for(int i=l;i<=r;i++)
{
for(int j=i;j<=r;j++)
{
ll ta=a[i],tb=b[i],tc=c[i];
for(int k=i+1;k<=j;k++)
{
ta=ta&a[k];
tb=tb|b[k];
tc=gcd(tc,c[k]);
}
ans+=ta*tb%mod*tc%mod;
ans%=mod;
}
}
cout<<ans<<'\n';
}
return 0;
}