제출 #1128867

#제출 시각아이디문제언어결과실행 시간메모리
1128867Nurislam비밀 (JOI14_secret)C++17
0 / 100
437 ms4388 KiB
#include <bits/stdc++.h> #include "secret.h" int lc[9][1001]; void Init(int n, int a[]) { for(int i = 0; i < n; i++){ lc[0][i] = a[i]; } for(int i = 1; i < 9; i++){ int len = (1<<(i-1)); for(int j = len-1; j+len < n; j++){ lc[i][j] = Secret(lc[i-1][j-len], lc[i-1][j]); } } } int Query(int l, int r) { int ans = -1; for(int i = 8; i >= 0; i--){ int len = (1<<i); while(l+len-1 <= r){ if(ans == -1)ans = lc[i][l]; else{ ans = Secret(ans, lc[i][l]); } l+=len; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...