Submission #979092

# Submission time Handle Problem Language Result Execution time Memory
979092 2024-05-10T08:34:38 Z lftroq Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include<secret.h>

int pref[1005][1005],n,mask[1005];

void dnc(int l,int r,int level,int a[])
{
    int mid=(l+r)>>1;
    pref[mid][mid]=a[mid];
    pref[mid+1][mid+1]=a[mid+1];
    for(int i=mid+2;i<=r;i++) pref[mid+1][i]=Secret(pref[mid+1][i-1],a[i]);
    for(int i=mid-1;i>=l;i--) pref[mid][i]=Secret(pref[mid][i+1],a[i]);
    for(int i=mid+1;i<=r;i++) mask[i]|=(1<<level);
    if(l<mid) dnc(l,mid,level+1,a);
    if(mid+1<r) dnc(mid+1,r,level+1,a);
}

void Init(int N,int A[])
{
    dnc(0,N-1,0,A);
}

int Query(int L,int R)
{
    int k=__builtin_ctz(mask[L],mask[R]);
    return Secret(pref[k][L],pref[k+1][R]);
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:24:40: error: too many arguments to function 'int __builtin_ctz(unsigned int)'
   24 |     int k=__builtin_ctz(mask[L],mask[R]);
      |                                        ^