#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
#define in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define MX (int)5e3+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
int XXX;
int secret(int x, int y)
{
if(x == -1 || y == -1)
return x+y+1;
else
return Secret(x, y);
}
struct segment_tree
{
vector<int> tree;
void build(const int a[], int id, int l, int r)
{
int m = (l+r)/2;
if(l==r)
{
tree[m] = a[id];
return;
}
build(a, 2*id, l, m);
build(a, 2*id+1, m+1, r);
tree[id] = secret(tree[2*id], tree[2*id+1]);
return;
}
void init(int n, const int a[])
{
tree.resize(MX);
build(a, 1, 0, n-1);
return;
}
int query(int ql, int qr, int id, int l, int r)
{
if(qr < l || r < ql)
return -1;
if(ql <= l && r <= qr)
return tree[id];
int m = (l+r)/2;
int x = query(ql, qr, 2*id, l, m);
int y = query(ql, qr, 2*id+1, m+1, r);
return secret(x, y);
}
};
segment_tree work;
void Init(int n, int a[])
{
work.init(n, a);
XXX = n;
return;
}
int Query(int l, int r)
{
return work.query(l, r, 1, 0, XXX-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
98 ms |
2348 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912. |
2 |
Incorrect |
93 ms |
2272 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0. |
3 |
Incorrect |
92 ms |
2316 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912. |
4 |
Incorrect |
342 ms |
4240 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912. |
5 |
Incorrect |
348 ms |
4284 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912. |
6 |
Incorrect |
346 ms |
4236 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 0. |
7 |
Incorrect |
350 ms |
4400 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0. |
8 |
Incorrect |
346 ms |
4192 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870976. |
9 |
Incorrect |
351 ms |
4284 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 811480943. |
10 |
Incorrect |
345 ms |
4172 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 607371779. |