Submission #1332399

#TimeUsernameProblemLanguageResultExecution timeMemory
1332399rana_azkaSecret (JOI14_secret)C++20
0 / 100
332 ms4292 KiB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;

const int INF = 1e9;
const int MAXN = 1e3;
const int MAXLog = log2(MAXN) + 1;

#define md ((lf+rg)/2)
#define lc (pos*2)
#define rc (pos*2+1)

int n, m;
int arr[MAXN+5];
int segtree[4*MAXN+5];
int identitas;

int merge(int a, int b){
  return Secret(a, b);
}

void build(int lf, int rg, int pos){
  if(lf == rg){
    segtree[pos] = arr[lf];
    return ;
  }
  
  build(lf, md, lc);
  build(md+1, rg, rc);

  segtree[pos] = merge(segtree[lc], segtree[rc]);
}

int query(int ql, int qr, int lf, int rg, int pos){
  if(rg < ql || qr < lf) return identitas;
  if(ql <= lf && rg <= qr) return segtree[pos];
  return merge(query(ql, qr, lf, md, lc), query(ql, qr, md+1, rg, rc));
}

void Init(int N, int A[]) {
  n = N;
  for(int i = 1; i <= n; i++) arr[i] = A[i-1];

  if(Secret(123456, 0) == 123456) identitas = 0;
  else identitas = 1;

  build(1, n, 1);  
}

int Query(int L, int R) {
  int l = L + 1, r = R + 1;

  cout << query(l, r, 1, n, 1) << endl;

  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...