# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
961384 |
2024-04-12T03:00:37 Z |
ByeWorld |
Secret (JOI14_secret) |
C++14 |
|
389 ms |
5200 KB |
#include "secret.h"
#include <bits/stdc++.h>
#include <random>
#define ll long long
// #define int long long
#define fi first
#define se second
#define pb push_back
#define md ((l+r)>>1)
#define lf (id<<1)
#define rg ((id<<1)|1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,pii> ipii;
const int MAXN = 1e3+10;
const int MAXA = 1e6+10;
const int INF = 2e9+10;
const int LOG = 30;
const int MOD = 1e9+7;
int n;
int a[MAXN], dep[MAXN];
map <pii, int> m;
void bd(int DEP, int l, int r){
if(l>r) return;
// cout << DEP << ' ' << l << ' ' << r << " pp\n";
int mid = md;
dep[mid] = DEP;
if(l==r) return;
int val = a[mid];
for(int i=mid-1; i>=l; i--){
val = Secret(a[i], val); // ke kiri
m[pii(i, mid)] = val;
}
val = a[mid+1];
for(int i=mid+2; i<=r; i++){
val = Secret(val, a[i]); // ke kanan
m[pii(mid+1, i)] = val;
}
bd(DEP+1, l, mid-1); bd(DEP+1, mid+1, r);
}
void Init(int N, int x[]) {
n = N;
for(int i=0; i<n; i++){
a[i+1] = x[i]; m[pii(i+1, i+1)] = x[i];
}
bd(1, 1, n);
// for(int i=1; i<=n; i++) cout << dep[i] << " \n"[i==n];
}
int Query(int L, int R) {
L++; R++;
int idx = -1, mn = INF;
for(int i=L; i<=R; i++){
if(mn > dep[i]){
idx = i;
mn = dep[i];
}
}
return Secret(m[pii(L, idx)], m[pii(idx+1, R)]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
2900 KB |
Wrong Answer: Query(264, 271) - expected : 675707686, actual : 4619042. |
2 |
Incorrect |
101 ms |
2900 KB |
Wrong Answer: Query(210, 211) - expected : 558550312, actual : 558532904. |
3 |
Incorrect |
98 ms |
2900 KB |
Wrong Answer: Query(130, 131) - expected : 127065177, actual : 93509720. |
4 |
Incorrect |
364 ms |
4688 KB |
Wrong Answer: Query(571, 624) - expected : 309502044, actual : 309493852. |
5 |
Incorrect |
367 ms |
4772 KB |
Wrong Answer: Query(584, 592) - expected : 111053842, actual : 110791698. |
6 |
Incorrect |
367 ms |
4724 KB |
Wrong Answer: Query(915, 915) - expected : 282904741, actual : 278446241. |
7 |
Correct |
389 ms |
5200 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
385 ms |
4736 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
389 ms |
4948 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
382 ms |
4692 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |