# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
720096 |
2023-04-07T12:06:42 Z |
ifateen |
Secret (JOI14_secret) |
C++14 |
|
423 ms |
4468 KB |
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
struct SparseTable {
int N, LOG;
vector<vector<int>> table;
void init(vector<int> &v) {
N = v.size();
LOG = __builtin_clz(1) - __builtin_clz(N);
table.resize(LOG + 1);
table[0] = v;
for (int i = 1; i <= LOG; i++) {
table[i].resize(N - (1 << i) + 1);
for (int j = 0; j + (1 << i) <= N; j++) {
table[i][j] = Secret(table[i - 1][j], table[i - 1][j + (1 << (i - 1))]);
}
}
}
int query(int L, int R) {
int LOG2 = __builtin_clz(1) - __builtin_clz(R - L + 1);
return Secret(table[LOG2][L], table[LOG2][R - (1 << LOG2) + 1]);
}
};
SparseTable s;
void Init(int N, int A[]) {
vector<int> v(N);
int cnt = 0;
for (auto &i : v) i = A[cnt++];
s.init(v);
}
int Query(int L, int R) {
return s.query(L, R);
}
int Secret(int X, int Y);
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
111 ms |
2352 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 839935006. |
2 |
Incorrect |
112 ms |
2440 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 73044041. |
3 |
Incorrect |
112 ms |
2428 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 951413062. |
4 |
Incorrect |
411 ms |
4340 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 889372840. |
5 |
Incorrect |
423 ms |
4468 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 389074008. |
6 |
Incorrect |
416 ms |
4444 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 31281100. |
7 |
Incorrect |
422 ms |
4276 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 709920818. |
8 |
Incorrect |
417 ms |
4284 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 225603928. |
9 |
Incorrect |
420 ms |
4300 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 819205962. |
10 |
Incorrect |
419 ms |
4300 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 538241930. |