제출 #293195

#제출 시각아이디문제언어결과실행 시간메모리
293195fucking_do_it비밀 (JOI14_secret)C++14
0 / 100
527 ms4496 KiB
#include "secret.h" #include <bits/stdc++.h> using namespace std; const int inf = 1e3+9,lg = 12; int n,cnt = 0; int a[inf],Log2[inf],sparse[lg][inf]; vector<int> tmp; void Init(int N, int A[]) { n = N; Log2[1] = 0; for(int i=2;i<=n;i++) Log2[i] = Log2[i/2] + 1; for(int i=1;i<=n;i++) a[i] = A[i-1],sparse[0][i] = a[i]; for(int j=1;j<lg;j++) for(int i=1;i+(1<<j)-1<=n;i++) sparse[j][i] = Secret( sparse[j-1][i],sparse[j-1][ i+(1<<(j-1)) ] ),cnt++; //assert(cnt<=8000); } int Query(int L, int R) { L++,R++; int len = R-L+1; int k = Log2[len]; return Secret( sparse[k][L] , sparse[k][R-(1<<k)+1] ); }
#Verdict Execution timeMemoryGrader output
Fetching results...