Submission #1147277

#TimeUsernameProblemLanguageResultExecution timeMemory
1147277Math4Life2020Weirdtree (RMI21_weirdtree)C++20
Compilation error
0 ms0 KiB
#include "weirdtree.h" #include <bits/stdc++.h> using namespace std; long long h1[(ll)5e5]; void initialise(int N, int Q, int h0[]) { for (long long i=0;i<N;i++) { h1[i+1]=h0[i]; } } void cut(int l, int r, int k) { while (k>0) { long long xloc = -1; long long mval = 0; for (long long i=l;i<=r;i++) { if (h1[i]>mval) { mval = h1[i]; xloc = i; } } if (xloc==-1) { break; } h1[xloc]--; k--; } } void magic(int i, int x) { h1[i]=x; } long long inspect(int l, int r) { long long vf = 0; for (long long i=l;i<=r;i++) { vf += h1[i]; } return vf; }

Compilation message (stderr)

weirdtree.cpp:5:15: error: 'll' was not declared in this scope
    5 | long long h1[(ll)5e5];
      |               ^~
weirdtree.cpp:5:18: error: expected ']' before numeric constant
    5 | long long h1[(ll)5e5];
      |                  ^~~
      |                  ]
weirdtree.cpp: In function 'void initialise(int, int, int*)':
weirdtree.cpp:9:9: error: 'h1' was not declared in this scope; did you mean 'h0'?
    9 |         h1[i+1]=h0[i];
      |         ^~
      |         h0
weirdtree.cpp: In function 'void cut(int, int, int)':
weirdtree.cpp:18:17: error: 'h1' was not declared in this scope; did you mean 'y1'?
   18 |             if (h1[i]>mval) {
      |                 ^~
      |                 y1
weirdtree.cpp:26:9: error: 'h1' was not declared in this scope; did you mean 'y1'?
   26 |         h1[xloc]--;
      |         ^~
      |         y1
weirdtree.cpp: In function 'void magic(int, int)':
weirdtree.cpp:32:5: error: 'h1' was not declared in this scope; did you mean 'y1'?
   32 |     h1[i]=x;
      |     ^~
      |     y1
weirdtree.cpp: In function 'long long int inspect(int, int)':
weirdtree.cpp:38:15: error: 'h1' was not declared in this scope; did you mean 'y1'?
   38 |         vf += h1[i];
      |               ^~
      |               y1