Submission #344285

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3442852021-01-05 11:53:46TadijaSebez3단 점프 (JOI19_jumps)C++11
100 / 100
1520 ms67308 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=500050;
const int M=2*N;
const int inf=1e9+7;
int a[N],ls[M],rs[M],tsz,root,mx1[M],mx2[M],lzy[M];
void Build(int &c, int ss, int se)
{
c=++tsz;mx2[c]=-inf;lzy[c]=-inf;
if(ss==se){ mx1[c]=a[ss];return;}
int mid=ss+se>>1;
Build(ls[c],ss,mid);
Build(rs[c],mid+1,se);
mx1[c]=max(mx1[ls[c]],mx1[rs[c]]);
}
void Upd(int c, int x)
{
mx2[c]=max(mx2[c],mx1[c]+x);
lzy[c]=max(lzy[c],x);
}
void Push(int c)
{
if(lzy[c]!=-inf)
{
Upd(ls[c],lzy[c]);
Upd(rs[c],lzy[c]);
lzy[c]=-inf;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

jumps.cpp: In function 'void Build(int&, int, int)':
jumps.cpp:12:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   12 |  int mid=ss+se>>1;
      |          ~~^~~
jumps.cpp: In function 'void Set(int, int, int, int, int, int)':
jumps.cpp:36:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   36 |  int mid=ss+se>>1;
      |          ~~^~~
jumps.cpp: In function 'int Get(int, int, int, int, int)':
jumps.cpp:46:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   46 |  int mid=ss+se>>1;
      |          ~~^~~
jumps.cpp: In function 'int main()':
jumps.cpp:79:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   79 |  scanf("%i",&n);
      |  ~~~~~^~~~~~~~~
jumps.cpp:80:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   80 |  for(int i=1;i<=n;i++) scanf("%i",&a[i]);
      |                        ~~~~~^~~~~~~~~~~~
jumps.cpp:82:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   82 |  scanf("%i",&q);
      |  ~~~~~^~~~~~~~~
jumps.cpp:86:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   86 |   scanf("%i %i",&l,&r);
      |   ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...