# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
578695 |
2022-06-17T16:08:02 Z |
ddy888 |
Secret (JOI14_secret) |
C++17 |
|
471 ms |
8532 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb push_back
#define fi first
#define si second
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;
void debug_out() {cerr<<endl;}
template <typename Head, typename... Tail>
void debug_out(Head _H, Tail... _T) {cerr<<" "<<to_string(_H);debug_out(_T...);}
#define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 1030;
int n, arr[MAXN];
int t[MAXN][MAXN];
int lx[MAXN], rx[MAXN];
void dnc(int l, int r) {
if (l == r) return;
int m = (l + r) >> 1;
t[m][m] = arr[m];
t[m + 1][m + 1] = arr[m + 1];
for (int i = m - 1; i >= l; --i) if (i <= n) t[i][m] = Secret(arr[i], t[i + 1][m]);
for (int i = m + 2; i <= r; ++i) if (i <= n) t[m + 1][i] = Secret(arr[i], t[m + 1][i - 1]);
lx[m] = l;
rx[m + 1] = r;
dnc(l, m);
dnc(m + 1, r);
}
void Init(int N, int A[]) {
n = N;
for (int i = 1; i <= n; ++i) arr[i] = A[i - 1];
int sz = 1;
while (sz < n) sz *= 2;
dnc(1, sz);
}
int Query(int L, int R) {
++L, ++R;
if (L == R) return arr[L];
for (int i = 0; i <= 10; ++i) {
int m = (1 << i);
if (lx[m] <= L && rx[m + 1] >= R) return Secret(t[L][m], t[m + 1][R]);
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
49 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
128 ms |
4412 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587353226. |
2 |
Incorrect |
119 ms |
4436 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Incorrect |
115 ms |
6508 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 145096996. |
4 |
Incorrect |
460 ms |
8464 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 70926549. |
5 |
Incorrect |
427 ms |
8316 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 238602560. |
6 |
Incorrect |
454 ms |
8532 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 956424914. |
7 |
Incorrect |
448 ms |
8428 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 661138442. |
8 |
Incorrect |
471 ms |
8384 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 878738504. |
9 |
Incorrect |
460 ms |
8320 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 26754469. |
10 |
Incorrect |
450 ms |
8404 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 7889739. |