# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1034834 | ethanv13 | Secret (JOI14_secret) | C++17 | 309 ms | 4524 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include <secret.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#define ll long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
int sps[15][1005];
int l2(int p){
return 31-__builtin_clz(p);
}
void sp(int n,int a[]){
int k=l2(n);
for(int i=0;i<n;++i){
sps[0][i]=a[i];
}
for(int i=1;i<=k;++i){
for(int j=0;j+(1<<i)<=n;++j){
sps[i][j]=Secret(sps[i-1][j],sps[i-1][j+(1<<(i-1))]);
}
}
}
void Init(int N,int a[]){
sp(N,a);
}
int Query(int L,int R){
int i = l2(R-L+1);
int minimum = Secret(sps[i][L], sps[i][R - (1 << i) + 1]);
return minimum;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |