# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
908861 |
2024-01-17T00:47:47 Z |
vjudge1 |
Secret (JOI14_secret) |
C++17 |
|
0 ms |
0 KB |
#include <iostream>
#include <vector>
using namespace std;
vector<int> v;
int segtree[10000];
void build(int l, int r, int node) {
if(l == r) {
segtree[node] = v[l];
return;
}
int mid = (l+r)/2;
build(l, mid, node*2);
build(mid+1, r, node*2+1);
segtree[node] = Secret(segtree[node*2], segtree[node*2+1]);
}
int que(int l, int r, int tl, int tr, int node) {
if(tl > r || tr < l) {
return -1;
}
if(l <= tl && tr <= r) {
return segtree[node];
}
int mid = (tl+tr)/2;
int a, b;
a = que(l, r, tl, mid, node*2);
b = que(l, r, mid+1, tr, node*2+1);
if(a == -1) {
return b;
}
if(b == -1) {
return a;
}
return Secret(a, b);
}
int lol;
int Query(int L, int R) {
L++;
R++;
return que(L, R, 1, lol, 1);
}
void Init(int N, int A[]) {
lol = N;
v.push_back(0);
for(int i=0; i<N; i++) {
v.push_back(A[i]);
}
build(1, N, 1);
}
Compilation message
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:21:18: error: 'Secret' was not declared in this scope
21 | segtree[node] = Secret(segtree[node*2], segtree[node*2+1]);
| ^~~~~~
secret.cpp: In function 'int que(int, int, int, int, int)':
secret.cpp:49:9: error: 'Secret' was not declared in this scope
49 | return Secret(a, b);
| ^~~~~~