CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 00:31:33 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=88c4a2954a9e0c4f41f604f87df706e96dc856eb0bf93b0a57a80b2f4aaac585a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22yKx0thoVyFDWgmWcO91kbO7uL0R6oZNf%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d27eb66f8ad86d-BLR
RMQ - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int a[MAX],b[MAX],mx[MAX][20],mn[MAX][20],n;
- //preprocess O(nlogn) , quary O(1) ; no update can be handaled
- //from topcoder, array is 1-indexed
- void RMQ()
- {
- int i,j;
- for(i=1;i<=n;i++)mx[i][0]=i;
- for(i=1;i<=n;i++)mn[i][0]=i;
- for(j=1;(1<<j)<=n;j++){
- for(i=1;i+(1<<j)-1<=n;i++){
- if(a[mx[i][j-1]]>a[mx[i+(1<<(j-1))][j-1]])
- mx[i][j]=mx[i][j-1];
- else mx[i][j]=mx[i+(1<<(j-1))][j-1];
- }
- for(i=1;i+(1<<j)-1<=n;i++){
- if(b[mn[i][j-1]]<b[mn[i+(1<<(j-1))][j-1]])
- mn[i][j]=mn[i][j-1];
- else mn[i][j]=mn[i+(1<<(j-1))][j-1];
- }
- }
- }
- int mylog[3*MAX];
- void calclog()
- {
- int x=1,i=1,pw=0;
- while(x<MAX){
- x*=2;
- for(;i<x;i++){
- mylog[i]=pw;
- }
- pw++;
- mylog[i]=pw;
- i++;
- }
- }
- int get_mx(int i,int j)
- {
- int k=mylog[j-i+1];
- return max(a[mx[i][k]],a[mx[j-(1<<k)+1][k]]);
- }
- int get_mn(int i,int j)
- {
- int k=mylog[j-i+1];
- return min(b[mn[i][k]],b[mn[j-(1<<k)+1][k]]);
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
π Instant BTC Profit Method β
Working
JavaScript | 7 sec ago | 0.24 KB
-
π MAKE $2500 IN 15 MIN β
Working
JavaScript | 16 sec ago | 0.24 KB
-
Free Crypto Method (NEVER SEEN BEFORE)ββ F
JavaScript | 18 sec ago | 0.25 KB
-
π΅ Make 3000$ in 20 minutes π΅
JavaScript | 25 sec ago | 0.24 KB
-
ββ
Swapzone Glitch β
Working ββ L
JavaScript | 27 sec ago | 0.25 KB
-
π Swapzone +37% glitch
JavaScript | 35 sec ago | 0.24 KB
-
β
Make $2500 in 20 minutesβββ 7
JavaScript | 36 sec ago | 0.25 KB
-
π Swapzone +37% glitch β W
JavaScript | 44 sec ago | 0.25 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand