# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
247426 |
2020-07-11T11:04:33 Z |
receed |
Secret (JOI14_secret) |
C++14 |
|
530 ms |
4424 KB |
#include "secret.h"
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int N = 1000, L = 10;
int d[L][N + 1];
void Init(int n, int a[]) {
for (int i = 0; (1 << i) <= n; i++) {
int pw = 1 << i;
for (int j = pw; j <= n; j += pw * 2) {
d[i][j - 1] = a[j - 1];
if (j < n)
d[i][j] = a[j];
for (int k = j - 2; k >= j - pw; k--)
d[i][k] = Secret(a[k], d[i][k + 1]);
for (int k = j + 1; k < min(n, j + pw); k++)
d[i][k] = Secret(d[i][k - 1], a[k]);
}
}
}
int Query(int l, int r) {
if (l == r)
return d[0][l];
int x = l ^ r, pos = 0;
while ((2 << pos) <= x)
pos++;
return Secret(d[pos][l], d[pos][r]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
148 ms |
2424 KB |
Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
148 ms |
2428 KB |
Output is correct - number of calls to Secret by Init = 4097, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
149 ms |
2424 KB |
Output is correct - number of calls to Secret by Init = 4097, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
511 ms |
4344 KB |
Output is correct - number of calls to Secret by Init = 7979, maximum number of calls to Secret by Query = 1 |
5 |
Correct |
509 ms |
4416 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |
6 |
Correct |
510 ms |
4328 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |
7 |
Correct |
514 ms |
4344 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
530 ms |
4388 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
508 ms |
4344 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
508 ms |
4424 KB |
Output is correct - number of calls to Secret by Init = 7993, maximum number of calls to Secret by Query = 1 |