# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
578692 |
2022-06-17T15:37:48 Z |
ddy888 |
Secret (JOI14_secret) |
C++17 |
|
474 ms |
16712 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());
int n, arr[1010];
int t[1010][1010];
int scope[1010];
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]);
scope[m] = 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 (m >= L && scope[m] >= R) return Secret(t[L][m], t[m + 1][R]);
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:47:1: warning: control reaches end of non-void function [-Wreturn-type]
47 | }
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
119 ms |
4404 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587620235. |
2 |
Incorrect |
122 ms |
4312 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 68749376. |
3 |
Runtime error |
131 ms |
12644 KB |
Execution killed with signal 11 |
4 |
Runtime error |
454 ms |
16712 KB |
Execution killed with signal 11 |
5 |
Runtime error |
450 ms |
16608 KB |
Execution killed with signal 11 |
6 |
Runtime error |
464 ms |
16528 KB |
Execution killed with signal 11 |
7 |
Runtime error |
472 ms |
16520 KB |
Execution killed with signal 11 |
8 |
Runtime error |
439 ms |
16636 KB |
Execution killed with signal 11 |
9 |
Runtime error |
474 ms |
16548 KB |
Execution killed with signal 11 |
10 |
Runtime error |
470 ms |
16560 KB |
Execution killed with signal 11 |