fork download
  1. struct segtree {
  2. //static int n;
  3. vl t,lazy;
  4.  
  5. void init(/*vi &arr*/) {
  6. //n = arr.size();
  7. t = vl(n*4, INT_MAX);
  8. lazy = vl(n*4);
  9. }
  10. void push(int v) {
  11. if (!lazy[v]) return;
  12. t[2*v] = lazy[v];
  13. lazy[2*v] = lazy[v];
  14. t[2*v+1] = lazy[v];
  15. lazy[2*v+1] = lazy[v];
  16. lazy[v] = 0;
  17. }
  18. void upd(int l,int r,ll val,int tl=0,int tr=n,int v=1) {
  19. if (l>r) return;
  20. if (tl==l && tr==r)
  21. t[v] = val, lazy[v] = t[v];
  22. else {
  23. push(v);
  24. int tm = (tl+tr)/2;
  25. upd(l,min(tm,r),val,tl,tm,v*2);
  26. upd(max(tm+1,l),r,val,tm+1,tr,v*2+1);
  27. t[v] = min(t[2*v],t[2*v+1]);
  28. }
  29. }
  30. int get(int ind,int tl=0,int tr=n,int v=1) {
  31. if (tl==ind&&tr==ind)
  32. return t[v];
  33. int tm = (tl+tr)/2;
  34. if (ind <= tm) return get(ind,tl,tm,v*2);
  35. else return get(ind,tm+1,tr,v*2+1);
  36. }
  37. };
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:5: error: ‘vl’ does not name a type
     vl t,lazy;
     ^~
prog.cpp:18:26: error: ‘ll’ has not been declared
     void upd(int l,int r,ll val,int tl=0,int tr=n,int v=1) {
                          ^~
prog.cpp:18:49: error: ‘n’ was not declared in this scope
     void upd(int l,int r,ll val,int tl=0,int tr=n,int v=1) {
                                                 ^
prog.cpp:30:37: error: ‘n’ was not declared in this scope
     int get(int ind,int tl=0,int tr=n,int v=1) {
                                     ^
prog.cpp: In member function ‘void segtree::init()’:
prog.cpp:7:9: error: ‘t’ was not declared in this scope
         t = vl(n*4, INT_MAX);
         ^
prog.cpp:7:16: error: ‘n’ was not declared in this scope
         t = vl(n*4, INT_MAX);
                ^
prog.cpp:7:21: error: ‘INT_MAX’ was not declared in this scope
         t = vl(n*4, INT_MAX);
                     ^~~~~~~
prog.cpp:7:21: note: ‘INT_MAX’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’?
prog.cpp:1:1:
+#include <climits>
 struct segtree {
prog.cpp:7:21:
         t = vl(n*4, INT_MAX);
                     ^~~~~~~
prog.cpp:7:13: error: ‘vl’ was not declared in this scope
         t = vl(n*4, INT_MAX);
             ^~
prog.cpp:8:9: error: ‘lazy’ was not declared in this scope
         lazy = vl(n*4);
         ^~~~
prog.cpp: In member function ‘void segtree::push(int)’:
prog.cpp:11:14: error: ‘lazy’ was not declared in this scope
         if (!lazy[v]) return;
              ^~~~
prog.cpp:12:9: error: ‘t’ was not declared in this scope
         t[2*v] = lazy[v];
         ^
prog.cpp:12:18: error: ‘lazy’ was not declared in this scope
         t[2*v] = lazy[v];
                  ^~~~
prog.cpp: In member function ‘void segtree::upd(int, int, int, int, int, int)’:
prog.cpp:21:13: error: ‘t’ was not declared in this scope
             t[v] = val, lazy[v] = t[v];
             ^
prog.cpp:21:25: error: ‘lazy’ was not declared in this scope
             t[v] = val, lazy[v] = t[v];
                         ^~~~
prog.cpp:25:19: error: ‘min’ was not declared in this scope
             upd(l,min(tm,r),val,tl,tm,v*2);
                   ^~~
prog.cpp:26:17: error: ‘max’ was not declared in this scope
             upd(max(tm+1,l),r,val,tm+1,tr,v*2+1);
                 ^~~
prog.cpp:27:13: error: ‘t’ was not declared in this scope
             t[v] = min(t[2*v],t[2*v+1]);
             ^
prog.cpp:27:13: note: suggested alternative: ‘tm’
             t[v] = min(t[2*v],t[2*v+1]);
             ^
             tm
prog.cpp: In member function ‘int segtree::get(int, int, int, int)’:
prog.cpp:32:20: error: ‘t’ was not declared in this scope
             return t[v];
                    ^
prog.cpp:32:20: note: suggested alternative: ‘tl’
             return t[v];
                    ^
                    tl
stdout
Standard output is empty