| 比赛 |
期末考试0 |
评测结果 |
AWWTTTTTTT |
| 题目名称 |
我能在摸鱼被发现的情况下躲避教练的视奸吗 |
最终得分 |
10 |
| 用户昵称 |
yyswys |
运行时间 |
22.879 s |
| 代码语言 |
C++ |
内存使用 |
5.21 MiB |
| 提交时间 |
2026-02-07 11:02:22 |
显示代码纯文本
#include<bits/stdc++.h>
#define ll long long
#define cin std::cin
#define cout std::cout
#define ciallo ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 5e5+5;
int a[N],b[N],c[N],n,m,L,R;
int main(){
freopen("shijian.in","r",stdin);
freopen("shijian.out","w",stdout);
ciallo
if(!(cin>>n>>m)) return 0;
for(int i(1);i<=n;++i) cin>>a[i];
for(int i(1);i<=n;++i) cin>>b[i];
for(int i(1);i<=n;++i) cin>>c[i];
while(m--){
cin>>L>>R;
int ans(0);
for(int i(L);i<=R;++i){
int cur_a(a[i]),cur_b(b[i]),cur_c(c[i]);
for (int j(i);j>=L;--j){
ans+=(cur_a&=a[j])*(cur_b|=b[j])*(cur_c=__gcd(cur_c,c[j]));
}
}
cout<<ans<<"\n";
}
return 0;
}