Submission #908864

#TimeUsernameProblemLanguageResultExecution timeMemory
908864vjudge1Secret (JOI14_secret)C++17
30 / 100
426 ms4500 KiB
#include <iostream> #include <vector> #include "secret.h" using namespace std; vector<int> v; int segtree[10000]; void build(int l, int r, int node) { if(l == r) { segtree[node] = v[l]; return; } int mid = (l+r)/2; build(l, mid, node*2); build(mid+1, r, node*2+1); segtree[node] = Secret(segtree[node*2], segtree[node*2+1]); } int que(int l, int r, int tl, int tr, int node) { if(tl > r || tr < l) { return -1; } if(l <= tl && tr <= r) { return segtree[node]; } int mid = (tl+tr)/2; int a, b; a = que(l, r, tl, mid, node*2); b = que(l, r, mid+1, tr, node*2+1); if(a == -1) { return b; } if(b == -1) { return a; } return Secret(a, b); } int lol; int Query(int L, int R) { L++; R++; return que(L, R, 1, lol, 1); } void Init(int N, int A[]) { lol = N; v.push_back(0); for(int i=0; i<N; i++) { v.push_back(A[i]); } build(1, N, 1); }
#Verdict Execution timeMemoryGrader output
Fetching results...