Submission #112867

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1128672019-05-22 10:46:16AnaiSecret (JOI14_secret)C++14
100 / 100
516 ms4696 KiB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
vector<int> pom[N * 4];
int v[N];
int n, ql, qr;
static inline void build(int nod, int st, int dr) {
if (st == dr) {
pom[nod] = {v[st]};
return; }
int mid = (st + dr) / 2;
build(2 * nod, st, mid);
build(2 * nod + 1, mid + 1, dr);
pom[nod].resize(dr - st + 1);
pom[nod][mid - st] = v[mid];
pom[nod][mid + 1 - st] = v[mid + 1];
for (int i = mid + 2; i <= dr; ++i)
pom[nod][i - st] = Secret(pom[nod][i - 1 - st], v[i]);
for (int i = mid - 1; i >= st; --i)
pom[nod][i - st] = Secret(v[i], pom[nod][i + 1 - st]); }
static int query(int nod, int st, int dr) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...