답안 #54650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
54650 2018-07-04T11:01:19 Z red1108 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <algorithm>
using namespace std;
int seg[20000], si=1;
void Init(int N, int A[])
{
    int input[20000],i;
    while(si<N) si*=2;
    for(i=N;i>=1;i--)
    {
        input[i]=A[i-1];
    }
    for(i=1;i<=si*4;i++) seg[i]=123456789;
    for(i=si+N-1;i>=si;i--)
    {
        seg[i]=input[i-si+1];
    }
    for(i=si-1;i>=1;i--)
    {
        if(seg[i*2]==123456789)seg[i]=123456789;
        else if(seg[i*2+1]==123456789)seg[i]=seg[i*2];
        else seg[i]=Secret(seg[i*2],seg[i*2+1]);
    }
}
int query(int x, int l, int r, int s, int e)
{
    int mid, left, right;
    if(r<s||l>e||l>r) return 123456789;
    if(s<=l&&r<=e) return seg[x];
    left=query(x*2, l,(l+r)/2,s,e);
    right=query(x*2+1, ((l+r)/2)+1,r, s, e);
    if(left==123456789&&right==123456789) return 123456789;
    else if(right==123456789) return left;
    else if(left==123456789) return right;
    else return Secret(left, right);
}
int Query(int L, int R)
{
    L++;
    R++;
    return query(1,1,si,L, R);
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:22:21: error: 'Secret' was not declared in this scope
         else seg[i]=Secret(seg[i*2],seg[i*2+1]);
                     ^~~~~~
secret.cpp:22:21: note: suggested alternative: 'qecvt'
         else seg[i]=Secret(seg[i*2],seg[i*2+1]);
                     ^~~~~~
                     qecvt
secret.cpp: In function 'int query(int, int, int, int, int)':
secret.cpp:35:17: error: 'Secret' was not declared in this scope
     else return Secret(left, right);
                 ^~~~~~
secret.cpp:35:17: note: suggested alternative: 'qecvt'
     else return Secret(left, right);
                 ^~~~~~
                 qecvt
secret.cpp:27:9: warning: unused variable 'mid' [-Wunused-variable]
     int mid, left, right;
         ^~~