답안 #487200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
487200 2021-11-14T19:18:09 Z AnasBenMoussa 비밀 (JOI14_secret) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "secret.h"


long long  a[10000];
int tree[400000];int n;
void build(int v, int tl, int tr) {
    if (tl == tr) {
        tree[v] = a[tl];
    } else {
        int tm = (tl + tr) / 2;
        build( v*2, tl, tm);
        build( v*2+1, tm+1, tr);
        tree[v] = Secret(tree[v*2],tree[v*2+1]);
    }
}
void Init(int N, int A[]){
    n=N;
   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 'int sum(int, int, int, int, int)':
secret.cpp:31:39: error: 'min' was not declared in this scope; did you mean 'std::min'?
   31 |     return Secret(sum(v*2, tl, tm, l, min(r, tm))
      |                                       ^~~
      |                                       std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from secret.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
secret.cpp:32:35: error: 'max' was not declared in this scope; did you mean 'std::max'?
   32 |             ,sum(v*2+1, tm+1, tr, max(l, tm+1), r));
      |                                   ^~~
      |                                   std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from secret.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~