Submission #1099562

#TimeUsernameProblemLanguageResultExecution timeMemory
1099562dzhoz0Secret (JOI14_secret)C++17
0 / 100
330 ms8888 KiB
/* ghmt the cutie :3 UwU */ #include <bits/stdc++.h> #include "secret.h" using namespace std; #define INF 1e9 #define f first #define s second #define pii pair<int, int> #define vi vector<int> #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i) #define R0F(i,a) ROF(i,0,a) template<typename T, int SZ> struct RangeQuery { int n; T stor[SZ][32-__builtin_clz(SZ)], id = 1; vector<T> a; T comb (T a, T b) { return Secret(a, b); } // associative operation void fill(int l, int r, int ind) { if (ind < 0) return; int m = (l+r)/2; T prod = id; ROF(i,l,m) stor[i][ind] = prod = comb(a[i],prod); prod = id; FOR(i,m,r) stor[i][ind] = prod = comb(prod,a[i]); fill(l,m,ind-1); fill(m,r,ind-1); } void init() { n = 1; while ((1<<n) < a.size()) ++n; a.resize(1<<n); fill(0,(1<<n),n-1); } T query(int l, int r) { if (l == r) return a[l]; int t = 31-__builtin_clz(r^l); return comb(stor[l][t],stor[r][t]); } }; const int MAXN = 1000; RangeQuery<long long, MAXN + 5> rq; void Init(int n, int a[]) { for(int i = 0; i < n; i++) rq.a.push_back(a[i]); rq.init(); } int Query(int l, int r) { return rq.query(l, r); }

Compilation message (stderr)

secret.cpp: In instantiation of 'void RangeQuery<T, SZ>::init() [with T = long long int; int SZ = 1005]':
secret.cpp:48:13:   required from here
secret.cpp:33:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int, std::allocator<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   n = 1; while ((1<<n) < a.size()) ++n;
      |                 ~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...