Submission #747134

#TimeUsernameProblemLanguageResultExecution timeMemory
747134Markomafko972Secret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include "secret.h" int n; int a[1005]; int val[1005][1005]; vector<int> v[1005]; int maxid = 0; // 4: 0 1 2 3 void rek(int l, int r, int d) { maxid = max(maxid, d); if (l+1 == r) { v[d].push_back(l); val[l][l] = a[l]; return; } int mid = (l+r)/2; int tren = a[mid-1]; for (int j = mid-2; j >= l; j--) { tren = Secret(tren, a[j]); val[j][mid-1] = tren; } tren = a[mid]; for (int j = mid+1; j < r; j++) { tren = Secret(tren, a[j]); val[mid][j] = tren; } v[d].push_back(mid); rek(l, mid, d+1); rek(mid, r, d+1); } void Init(int N, int A[]) { n = N; for (int i = 0; i < n; i++) a[i] = A[i]; rek(0, n, 0); } int Query(int l, int r) { for (int i = 0; i <= maxid; i++) { for (int j = 0; j < v[i].size(); j++) { if (l <= v[i][j] && v[i][j] <= r) { return Secret(val[l][val[i][j]-1], val[v[i][j]][r]); } } } }

Compilation message (stderr)

secret.cpp:6:1: error: 'vector' does not name a type
    6 | vector<int> v[1005];
      | ^~~~~~
secret.cpp: In function 'void rek(int, int, int)':
secret.cpp:12:10: error: 'max' was not declared in this scope; did you mean 'maxid'?
   12 |  maxid = max(maxid, d);
      |          ^~~
      |          maxid
secret.cpp:14:3: error: 'v' was not declared in this scope
   14 |   v[d].push_back(l);
      |   ^
secret.cpp:30:2: error: 'v' was not declared in this scope
   30 |  v[d].push_back(mid);
      |  ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:44:23: error: 'v' was not declared in this scope
   44 |   for (int j = 0; j < v[i].size(); j++) {
      |                       ^