답안 #53144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53144 2018-06-28T20:19:55 Z okaybody10 비밀 (JOI14_secret) C++
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
typedef long long ll;
ll T[1006];
int B[1006];
void Init(int N,int A[])
{
    for(int i=0;i<N-1;i++) T[i]=secret(A[i],A[i+1]); 
}
int Query(int L,int R)
{
    if(R==L) return B[L];
    if(R==L+1) return T[L];
    int mid=(L+R)/2;
    return secret(Query(L,(L+R)/2),Query((L+R)/2+1,R));
}
int main()
{
    int N; scanf("%d",&N);
    for(int i=0;i<N;i++) scanf("%d",&B[i]);
    Init(N,B);
    int Q; scanf("%d",&Q);
    while(Q--)
    {
        int x,y; scanf("%d %d",&x,&y);
        printf("%d\n",Query(x,y));
    }
    return 0;
}

Compilation message

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:9:33: error: 'secret' was not declared in this scope
     for(int i=0;i<N-1;i++) T[i]=secret(A[i],A[i+1]); 
                                 ^~~~~~
secret.cpp:9:33: note: suggested alternative: 'Secret'
     for(int i=0;i<N-1;i++) T[i]=secret(A[i],A[i+1]); 
                                 ^~~~~~
                                 Secret
secret.cpp: In function 'int Query(int, int)':
secret.cpp:16:12: error: 'secret' was not declared in this scope
     return secret(Query(L,(L+R)/2),Query((L+R)/2+1,R));
            ^~~~~~
secret.cpp:16:12: note: suggested alternative: 'Secret'
     return secret(Query(L,(L+R)/2),Query((L+R)/2+1,R));
            ^~~~~~
            Secret
secret.cpp:15:9: warning: unused variable 'mid' [-Wunused-variable]
     int mid=(L+R)/2;
         ^~~
secret.cpp: In function 'int main()':
secret.cpp:20:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int N; scanf("%d",&N);
            ~~~~~^~~~~~~~~
secret.cpp:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<N;i++) scanf("%d",&B[i]);
                          ~~~~~^~~~~~~~~~~~
secret.cpp:23:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int Q; scanf("%d",&Q);
            ~~~~~^~~~~~~~~
secret.cpp:26:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int x,y; scanf("%d %d",&x,&y);
                  ~~~~~^~~~~~~~~~~~~~~