Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
44540 112 数列操作1 C++ 解答错误 0 19 MS 404 KB 855 2022-02-09 10:04:34

Tests(0/10):


//array1 #include <bits/stdc++.h> using namespace std; struct option { int opt,l,r,c; } o[50005]; int n,m,bl[100005],block; long long a[100005],tag[100005]; void add(int l,int r,int x) { for (int i=l; i<=min(bl[l]*block,r); i++) a[i]+=x; if (bl[l]!=bl[r]) for(int i=block*(bl[r]-1)+1; i<=r; i++) a[i]+=x; for(int i=bl[l]+1; i<=bl[r]-1; i++) tag[i]+=x; } void check(int l,int r,int x) { int cnt=0; x*=x; for(int j=l; j<=r; j++) { if(a[j]<x) cnt++; else continue; } cout<<cnt<<endl; } int main() { cin>>n; for(int p=1; p<=n; p++) cin>>a[p]; for(int p=1; p<=n; p++) { cin>>o[p].opt>>o[p].l>>o[p].r>>o[p].c; if(o[p].opt==1) check(o[p].l,o[p].r,o[p].c); else add(o[p].l,o[p].r,o[p].c); } cout<<endl; return 0; }


测评信息: