# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
49484 |
2018-05-29T15:43:51 Z |
Anai |
Secret (JOI14_secret) |
C++14 |
|
0 ms |
0 KB |
#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1024;
int ql, qr, n, *v;
int tree_l[4 * NMAX][NMAX], tree_r[4 * NMAX][NMAX];
static void build(int nod, int l, int r) {
if (l == r) {
tree_l[nod][l] = tree_r[nod][r] = v[l];
return; }
int mid = (l + r) / 2;
build(2 * nod, l, mid);
build(2 * nod + 1, mid + 1, r);
tree_l[nod][mid] = v[mid];
tree_r[nod][mid + 1] = v[mid + 1];
for (int i = mid - 1; i >= l; --i)
tree_l[nod][i] = Secret(v[i], tree_l[nod][i + 1]);
for (int i = mid + 2; i <= r; ++i)
tree_r[nod][i] = Secret(tree_r[nod][i - 1], v[i]); }
static int query(int nod, int l, int r) {
if (l == r) return v[l];
const int mid = (l + r) / 2;
if (ql <= mid && mid < qr)
return Secret(tree_l[nod][ql], tree_r[nod][qr]);
return ql <= mid ? query(2 * nod, l, mid) : query(2 * nod + 1, mid + 1, r); }
void Init(int N, int A[]) {
tie(n, v) = tie(N, A);
build(1, 0, n - 1); }
int Query(int L, int R) {
tie(ql, qr) = tie(L, R);
return query(1, 0, n - 1); }
Compilation message
secret.cpp:1:10: fatal error: grader.cpp: No such file or directory
#include "grader.cpp"
^~~~~~~~~~~~
compilation terminated.