Submission #852725

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8527252023-09-22 15:33:09sleepntsheepSecret (JOI14_secret)C++17
Compilation error
0 ms0 KiB
include <vector>
#include "secret.h"
#include <assert.h>
#define N 1050
int n, *a;
std::vector<int> pre[N<<1], suf[N<<1];
void build(int v, int l, int r)
{
if (l == r)
{
pre[v] = suf[v] = {a[l]};
return;
}
int m=(l+r)/2, vl=v+1, vr=v+(m-l+1)*2;
pre[v].resize(r-l+1);
suf[v].resize(r-l+1);
suf[v][r-l] = a[r];
for (int i = r-l-1, j = r-1; j >= l; --j, --i)
suf[v][i] = Secret(a[j], suf[v][i+1]);
pre[v][0] = a[l];
for (int i = 1, j = l + 1; j <= r; ++j, ++i)
pre[v][i] = Secret(pre[v][i-1], a[j]);
build(vl, l, m);
build(vr, m+1, r);
}
int qry(int v, int l, int r, int x, int y)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

secret.cpp:1:1: error: 'include' does not name a type
    1 | include <vector>
      | ^~~~~~~
secret.cpp:7:6: error: 'vector' in namespace 'std' does not name a template type
    7 | std::vector<int> pre[N<<1], suf[N<<1];
      |      ^~~~~~
secret.cpp:4:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    3 | #include <assert.h>
  +++ |+#include <vector>
    4 | #define N 1050
secret.cpp: In function 'void build(int, int, int)':
secret.cpp:13:9: error: 'pre' was not declared in this scope
   13 |         pre[v] = suf[v] = {a[l]};
      |         ^~~
secret.cpp:13:18: error: 'suf' was not declared in this scope
   13 |         pre[v] = suf[v] = {a[l]};
      |                  ^~~
secret.cpp:17:5: error: 'pre' was not declared in this scope
   17 |     pre[v].resize(r-l+1);
      |     ^~~
secret.cpp:18:5: error: 'suf' was not declared in this scope
   18 |     suf[v].resize(r-l+1);
      |     ^~~
secret.cpp: In function 'int qry(int, int, int, int, int)':
secret.cpp:33:24: error: 'pre' was not declared in this scope
   33 |     if (l == x) return pre[v][y-x];
      |                        ^~~
secret.cpp:34:24: error: 'suf' was not declared in this scope
   34 |     if (r == y) return suf[v][suf[v].size()-1-(y-x)];
      |                        ^~~