QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#687208#9231. Random Numbers_Veritas#Compile Error//C++14879b2024-10-29 17:36:422024-10-29 17:36:43

Judging History

你现在查看的是最新测评结果

  • [2024-10-29 17:36:43]
  • 评测
  • [2024-10-29 17:36:42]
  • 提交

answer

#include<bits[表情]dc++.h>
#define ll long long
using namespace std;
const int N=2e5+5;
const int M=500;
int read(){
    int s=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}
    return s*f;
}
ll sum[N];
int n,m,a[N];
int Count(int len){
    int res=0;
    for(int i=len;i<=n;i++){
        res+=(sum[i]-sum[i-len]==1ll*len*len);
    }
    return res;
}
int main(){
    int T=read();
    while(T--){
        n=read();
        for(int i=1;i<=n;i++){
            a[i]=read();
            sum[i]=sum[i-1]+a[i];
        }
        ll ans=0;
        for(int i=1;i<=min(n,M*2);i++){
            ans+=Count(i);
        }
        for(int i=max(n/2-M,M*2+1);i<=min(n/2+M,n);i++){
            ans+=Count(i);
        }
        printf("%lld\n",ans);
    }
    return 0;
}

Details

answer.code:1:9: fatal error: bits[表情]dc++.h: No such file or directory
    1 | #include<bits[表情]dc++.h>
      |         ^~~~~~~~~~~~~~~~~~
compilation terminated.