# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52461 | 2018-06-26T04:36:10 Z | tataky(#1353) | Secret (JOI14_secret) | C++11 | 728 ms | 4768 KB |
#include "secret.h" int sp[10][1001], to[10][1001], n; int a[1001]; int Query(int L, int R) { if (L == R) return a[L]; int len = R - L + 1; int ret, cur = L; bool fst = true; for (int h = 9; h >= 0; h--) if (len&(1 << h)) { if (fst) { ret = sp[h][cur]; cur = to[h][cur] + 1; fst = false; } else { ret = Secret(ret, sp[h][cur]); cur = to[h][cur] + 1; } } return ret; } void setsparse() { for (int i = 0; i < n; i++) { sp[0][i] = a[i]; to[0][i] = i; } for (int h = 1; h <= 9; h++) { for (int i = 0; i < n; i++) if (i + (1 << h) - 1< n) { to[h][i] = to[h - 1][to[h - 1][i] + 1]; sp[h][i] = Secret(sp[h - 1][i], sp[h - 1][to[h - 1][i] + 1]); } } } void Init(int N, int A[]) { n = N; for (int i = 0; i < n; i++) a[i] = A[i]; setsparse(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 203 ms | 2424 KB | Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 | Partially correct | 212 ms | 2536 KB | Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7 |
3 | Partially correct | 207 ms | 2588 KB | Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7 |
4 | Partially correct | 641 ms | 4388 KB | Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8 |
5 | Partially correct | 648 ms | 4464 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
6 | Partially correct | 591 ms | 4464 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2 |
7 | Partially correct | 684 ms | 4576 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
8 | Partially correct | 687 ms | 4768 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |
9 | Partially correct | 715 ms | 4768 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 | Partially correct | 728 ms | 4768 KB | Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |