Submission #748966

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7489662023-05-27 08:21:55model_codeSequence (APIO23_sequence)C++17
100 / 100
942 ms53732 KiB
#include "sequence.h"
#include<bits/stdc++.h>
#define re register
using namespace std;
int n,m,a[500002],ans,mx[2000002],mn[2000002],sum,tg[2000002],Mx,Mn,pmx[2000002],pmn[2000002],smx[2000002],smn[2000002],Q[500002],hd,tl;
vector<int>AA[500002];
inline void Add(re int p,re int x){
mx[p]+=x,mn[p]+=x,tg[p]+=x;
}
inline void pd(re int p){
if(tg[p])Add(p<<1,tg[p]),Add(p<<1|1,tg[p]),tg[p]=0;
}
inline void pu(re int p){
mx[p]=max(mx[p<<1],mx[p<<1|1]);
mn[p]=min(mn[p<<1],mn[p<<1|1]);
}
inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
if(l>=x&&r<=y)return Add(p,z);
pd(p);
re int mid=l+r>>1;
if(x<=mid)add(p<<1,l,mid,x,y,z);
if(y>mid)add(p<<1|1,mid+1,r,x,y,z);
pu(p);
}
inline void ask(re int p,re int l,re int r,re int x,re int y){
if(l>=x&&r<=y){
Mx=max(Mx,mx[p]),Mn=min(Mn,mn[p]);
return;
}
pd(p);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sequence.cpp:7:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 | inline void Add(re int p,re int x){
      |                        ^
sequence.cpp:7:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
    7 | inline void Add(re int p,re int x){
      |                                 ^
sequence.cpp:10:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   10 | inline void pd(re int p){
      |                       ^
sequence.cpp:13:23: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   13 | inline void pu(re int p){
      |                       ^
sequence.cpp:17:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                        ^
sequence.cpp:17:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                                 ^
sequence.cpp:17:42: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                                          ^
sequence.cpp:17:51: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                                                   ^
sequence.cpp:17:60: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                                                            ^
sequence.cpp:17:69: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 | inline void add(re int p,re int l,re int r,re int x,re int y,re int z){
      |                                                                     ^
sequence.cpp: In function 'void add(int, int, int, int, int, int)':
sequence.cpp:20:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |  re int mid=l+r>>1;
      |             ~^~
sequence.cpp:20:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   20 |  re int mid=l+r>>1;
      |         ^~~
sequence.cpp: At global scope:
sequence.cpp:25:24: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 | inline void ask(re int p,re int l,re int r,re int x,re int y){
      |                        ^
sequence.cpp:25:33: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 | inline void ask(re int p,re int l,re int r,re int x,re int y){
      |                                 ^
sequence.cpp:25:42: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 | inline void ask(re int p,re int l,re int r,re int x,re int y){
      |                                          ^
sequence.cpp:25:51: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 | inline void ask(re int p,re int l,re int r,re int x,re int y){
      |                                                   ^
sequence.cpp:25:60: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   25 | inline void ask(re int p,re int l,re int r,re int x,re int y){
      |                                                            ^
sequence.cpp: In function 'void ask(int, int, int, int, int)':
sequence.cpp:31:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   31 |  re int mid=l+r>>1;
      |             ~^~
sequence.cpp:31:9: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   31 |  re int mid=l+r>>1;
      |         ^~~
sequence.cpp: In function 'int sequence(int, std::vector<int>)':
sequence.cpp:37:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   37 |  for(re int i=1;i<=n;++i)a[i]=A[i-1],AA[a[i]].push_back(i),add(1,0,n,i,n,1);
      |             ^
sequence.cpp:38:13: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   38 |  for(re int i=1;i<=n;++i){
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...