제출 #703775

#제출 시각아이디문제언어결과실행 시간메모리
703775dubabuba비밀 (JOI14_secret)C++14
30 / 100
520 ms4368 KiB
#include "secret.h" const int mxn = 2e5 + 10; int n, a[mxn], sus[mxn * 4]; void build(int id, int tl, int tr) { if(tl == tr) { sus[id] = a[tl]; return; } int tm = (tl + tr) / 2; build(id * 2 + 1, tl, tm); build(id * 2 + 2, tm + 1, tr); sus[id] = Secret(sus[id * 2 + 1], sus[id * 2 + 2]); } int query(int id, int tl, int tr, int l, int r) { if(tl == l && r == tr) return sus[id]; int tm = (tl + tr) / 2; if(r <= tm) return query(id * 2 + 1, tl, tm, l, r); if(tm < l) return query(id * 2 + 2, tm + 1, tr, l, r); return Secret(query(id * 2 + 1, tl, tm, l, tm), query(id * 2 + 2, tm + 1, tr, tm + 1, r)); } void Init(int N, int A[]) { n = N; for(int i = 0; i < n; i++) a[i] = A[i]; build(0, 0, N - 1); } int Query(int L, int R) { return query(0, 0, n - 1, L, R); }
#Verdict Execution timeMemoryGrader output
Fetching results...