제출 #1299331

#제출 시각아이디문제언어결과실행 시간메모리
1299331Faisal_Saqib비밀 (JOI14_secret)C++20
30 / 100
397 ms4436 KiB
#include "secret.h" #include <iostream> using namespace std; const int N=1001,LG=8; int st[N][LG]; void Init(int N, int A[]) { for(int j=0;j<N;j++) st[j][0]=A[j]; for(int j=1;j<LG;j++) { for(int i=0;i+(1<<j)<=N;i++) { st[i][j]=Secret(st[i][j-1],st[i+(1<<(j-1))][j-1]); } } } int Query(int L, int R) { int ans=1e9+7; // cout<<"cur "<<L<<' '<<R<<endl; for(int j=LG-1;j>=0;j--) { while((1<<j)<=R-L+1) { // cout<<L<<' '<<j<<' '<<ans<<' '<<st[L][j]<<endl; if(ans==1e9+7)ans=st[L][j]; else ans=Secret(ans,st[L][j]); L+=(1<<j); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...