Submission #503992

#TimeUsernameProblemLanguageResultExecution timeMemory
503992Abrar_Al_SamitSecret (JOI14_secret)C++17
30 / 100
487 ms4388 KiB
#include "secret.h" #include <iostream> using namespace std; int sp[1000][11]; void Init(int N, int A[]) { for(int i=0; i<N; ++i) { sp[i][0] = A[i]; } for(int j=1; j<11; ++j) { for(int i=0; i+(1<<j)-1<N; ++i) { sp[i][j] = Secret(sp[i][j-1], sp[i+(1<<(j-1))][j-1]); } } } int Query(int L, int R) { int ret = sp[L][0]; if(L==R) return ret; ++L; int len = R-L+1; int id = L; for(int j=0; j<11; ++j) if(len>>j&1) { ret = Secret(ret, sp[id][j]); id += 1<<j; } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...