Submission #558643

# Submission time Handle Problem Language Result Execution time Memory
558643 2022-05-07T19:42:36 Z groshi Secret (JOI14_secret) C++17
Compilation error
0 ms 0 KB
#include<iostream>
#include "secret.h"
using namespace std;
int n;
int t[100000];
long long wyn[1010][1010];
/*long long Secret(int x,int y)
{
    return x+y;
}*/
void rob(int l,int r)
{
    if(l>r)
        return;
    int sre=(l+r)/2;
    wyn[sre][sre]=t[sre];
    wyn[sre+1][sre+1]=t[sre+1];
    for(int i=sre+2;i<=r;i++)
        wyn[sre+1][i]=Secret(wyn[sre+1][i-1],t[i]);
    for(int i=sre-1;i>=l;i--)
        wyn[i][sre]=Secret(wyn[i+1][sre],t[i]);
    if(sre>l)
        rob(l,sre);
    if(sre+1<r)
        rob(sre+1,r);
}
long long zap(int x1,int y1,int l,int r)
{
    int mid=(x1+y1)/2;
    if(x1==y1)
        return wyn[x1][y1];
    if(l<=mid && mid<r)
        return Secret(wyn[l][mid],wyn[mid+1][r]);
    if(l>mid)
        return zap(mid+1,r,l,r);
    else return zap(l,mid,l,r);
}
void Init(int N,int A[])
{
    n=N;
    for(int i=0;i<n;i++)
        t[i]=A[i];
    rob(0,n-1);
}
long long Query(int l,int r)
{
    return zap(0,n-1,l,r);
}

Compilation message

secret.cpp:45:11: error: ambiguating new declaration of 'long long int Query(int, int)'
   45 | long long Query(int l,int r)
      |           ^~~~~
In file included from secret.cpp:2:
secret.h:5:5: note: old declaration 'int Query(int, int)'
    5 | int Query(int L, int R);
      |     ^~~~~