Submission #1034834

#TimeUsernameProblemLanguageResultExecution timeMemory
1034834ethanv13Secret (JOI14_secret)C++17
0 / 100
309 ms4524 KiB
#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 timeMemoryGrader output
Fetching results...