답안 #487196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487196 2021-11-14T19:14:58 Z AnasBenMoussa 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include "secret.h"
long long  a[10000];
int tree[400000];
void build(int v, int tl, int tr) {
    if (tl == tr) {
        tree[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build(a, v*2, tl, tm);
        build(a, v*2+1, tm+1, tr);
        tree[v] = Secret(tree[v*2],tree[v*2+1]);
    }
}
void Init(int N, int A[]){
   for(long long  i=0;i<N;i++){
        a[i]=A[i];
   }
   build(0,0,N-1);
}
int sum(int v, int tl, int tr, int l, int r) {
    if (l > r) 
        return 0;
    if (l == tl && r == tr) {
        return tree[v];
    }
    int tm = (tl + tr) / 2;
    return Secret(sum(v*2, tl, tm, l, min(r, tm))
            ,sum(v*2+1, tm+1, tr, max(l, tm+1), r));
}


int  Query(int L , int R){
    
    return sum(0,0,N-1,L,R);
}


Compilation message

secret.cpp: In function 'void build(int, int, int)':
secret.cpp:9:15: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
    9 |         build(a, v*2, tl, tm);
      |               ^
      |               |
      |               long long int*
secret.cpp:9:29: error: too many arguments to function 'void build(int, int, int)'
    9 |         build(a, v*2, tl, tm);
      |                             ^
secret.cpp:4:6: note: declared here
    4 | void build(int v, int tl, int tr) {
      |      ^~~~~
secret.cpp:10:15: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
   10 |         build(a, v*2+1, tm+1, tr);
      |               ^
      |               |
      |               long long int*
secret.cpp:10:33: error: too many arguments to function 'void build(int, int, int)'
   10 |         build(a, v*2+1, tm+1, tr);
      |                                 ^
secret.cpp:4:6: note: declared here
    4 | void build(int v, int tl, int tr) {
      |      ^~~~~
secret.cpp: In function 'int sum(int, int, int, int, int)':
secret.cpp:27:39: error: 'min' was not declared in this scope
   27 |     return Secret(sum(v*2, tl, tm, l, min(r, tm))
      |                                       ^~~
secret.cpp:28:35: error: 'max' was not declared in this scope
   28 |             ,sum(v*2+1, tm+1, tr, max(l, tm+1), r));
      |                                   ^~~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:34:20: error: 'N' was not declared in this scope
   34 |     return sum(0,0,N-1,L,R);
      |                    ^