Submission #406634

# Submission time Handle Problem Language Result Execution time Memory
406634 2021-05-17T21:57:03 Z ScarletS Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"

int n, a[1000], pre[1000][1000];

int Secret(int l, int r)
{
    return l-l+r-r+69;
}

void build(int l, int r)
{
    if (l+1>=r)
        return;
    int m=l+(r-l)/2;
    pre[m][m]=a[m];
    pre[m+1][m+1]=a[m];
    for (int i=m-1;i>=l;--i)
        pre[i][m]=Secret(a[i],pre[i+1][m]);
    for (int i=m+2;i<=r;++i)
        pre[m+1][i]=Secret(pre[m+1][i-1],a[i]);
    build(l,m);
    build(m+1,r);
}

void Init(int N, int A[])
{
    n=N;
    for (int i=0;i<n;++i)
        a[i]=A[i];
    build(1,n);
}

int Query(int l, int r)
{
    if (l==r)
        return a[l];
    if (l+1==r)
        return Secret(a[l],a[r]);
    int x=0, y=n-1, m;
    while (1)
    {
        m=x+(y-x)/2;
        if (l<=m&&m<r)
            return Secret(pre[l][m],pre[m+1][r]);
        if (m<l)
            x=m+1;
        else
            y=m;
    }
    return -1;
}

Compilation message

/usr/bin/ld: /tmp/cc96LSNV.o: in function `Secret(int, int)':
secret.cpp:(.text+0x0): multiple definition of `Secret(int, int)'; /tmp/ccNwsvbV.o:grader-full.cpp:(.text+0x2d0): first defined here
collect2: error: ld returned 1 exit status