# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
368119 |
2021-02-19T15:23:12 Z |
Sorting |
Secret (JOI14_secret) |
C++17 |
|
517 ms |
4588 KB |
#include "secret.h"
#include <bits/stdc++.h>
const int N = 1000;
const int LOGN = 11;
int n, *a;
int d[LOGN][N], mask[N];
void dnc(int l, int r, int bit){
if(l == r) return;
int mid = (l + r) >> 1;
d[bit][mid] = a[mid];
for(int i = mid - 1; i >= l; --i)
d[bit][i] = Secret(a[i], d[bit][i + 1]);
d[bit][mid + 1] = a[mid + 1];
for(int i = mid + 2; i <= r; ++i)
d[bit][i] = Secret(d[bit][i - 1], a[i]);
for(int i = mid + 1; i <= n; ++i)
mask[i] ^= 1 << bit;
dnc(l, mid, bit + 1), dnc(mid + 1, r, bit + 1);
}
void Init(int N, int A[]){
n = N, a = A;
dnc(0, n - 1, 0);
}
int Query(int l, int r){
if(l == r) return a[r];
int bits = __builtin_ctz(mask[l] ^ mask[r]);
return Secret(d[bits][l], d[bits][r]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
2540 KB |
Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
142 ms |
2412 KB |
Output is correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
148 ms |
2412 KB |
Output is correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 1 |
4 |
Correct |
516 ms |
4308 KB |
Output is correct - number of calls to Secret by Init = 7969, maximum number of calls to Secret by Query = 1 |
5 |
Incorrect |
504 ms |
4460 KB |
Wrong Answer: Query(0, 508) - expected : 315104342, actual : 852237430. |
6 |
Correct |
509 ms |
4456 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
498 ms |
4460 KB |
Wrong Answer: Query(0, 993) - expected : 589312106, actual : 649633826. |
8 |
Correct |
517 ms |
4588 KB |
Output is correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 1 |
9 |
Incorrect |
495 ms |
4332 KB |
Wrong Answer: Query(0, 930) - expected : 424418475, actual : 969806894. |
10 |
Incorrect |
497 ms |
4296 KB |
Wrong Answer: Query(0, 893) - expected : 611994251, actual : 3098823. |