# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
935443 |
2024-02-29T05:22:10 Z |
Baizho |
Secret (JOI14_secret) |
C++14 |
|
429 ms |
4624 KB |
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
// #pragma GCC optimize("Ofast,unroll-loops,fast-math")
// #pragma GCC target("popcnt")
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
#define sz size()
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define pb push_back
const int mod = ll(1e9)+7;
const ll MOD = 998244353;
const long long inf = 5e18;
const int M = 1005;
int Secret(int x, int y);
int val[10][M], n, a[M];
void Init(int N, int A[]) {
n = N;
for(int i = 0; i < N; i ++) a[i] = A[i];
for(int i = 0; i < n; i ++) val[0][i] = a[i];
for(int j = 1; j <= 9; j ++) {
for(int i = 0; i + (1 << j) - 1 < n; i ++) {
val[j][i] = Secret(val[j - 1][i], val[j - 1][i + (1 << j - 1)]);
}
}
}
int Query(int L, int R) {
int l = L, r = R, siz = r - l + 1, res = -1;
for(int j = 9; l <= r && j >= 0; j --) {
if(siz & (1 << j)) {
if(res == -1) res = val[j][l];
else res = Secret(res, val[j][l]);
l += (1 << j);
}
}
return res;
}
Compilation message
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:40:61: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
40 | val[j][i] = Secret(val[j - 1][i], val[j - 1][i + (1 << j - 1)]);
| ~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
123 ms |
2640 KB |
Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7 |
2 |
Partially correct |
126 ms |
3064 KB |
Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7 |
3 |
Partially correct |
122 ms |
2852 KB |
Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7 |
4 |
Partially correct |
407 ms |
4432 KB |
Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8 |
5 |
Partially correct |
419 ms |
4532 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
6 |
Partially correct |
386 ms |
4624 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2 |
7 |
Partially correct |
409 ms |
4348 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
8 |
Partially correct |
429 ms |
4432 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |
9 |
Partially correct |
412 ms |
4436 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8 |
10 |
Partially correct |
419 ms |
4528 KB |
Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7 |