# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
536199 |
2022-03-12T15:06:40 Z |
michao |
Secret (JOI14_secret) |
C++14 |
|
20000 ms |
4532 KB |
#include <bits/stdc++.h>
#include "secret.h"
#define mp make_pair
#define pb push_back
#define ld long double
#define pii pair<int,int>
#define sz(x) (int)x.size()
#define piii pair<pii,pii>
#define precise cout<<fixed<<setprecision(10)
#define st first
#define nd second
#define ins insert
#define vi vector<int>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
const int MAX=1e3+5;
int pref[MAX][MAX];
int suf[MAX][MAX];
int n;
int a[MAX];
void rec1(int l,int r){
if (l>r)return;
int mid=(l+r)>>1;
pref[mid][mid]=a[mid];
suf[mid][mid+1]=a[mid+1];
for (int i=mid-1;i>=l;i--){
pref[mid][i]=Secret(a[i],pref[mid][i+1]);
}
for (int i=mid+1;i<=r;i++){
suf[mid][i]=Secret(suf[mid][i-1],a[i]);
}
rec1(l,mid);
rec1(mid+1,r);
}
void Init(int N,int A[]){
n=N;
for (int i=0;i<n;i++)a[i]=A[i];
rec1(0,n-1);
}
int rec2(int l,int r,int L,int R){
int mid=(l+r)>>1;
if (l<L)return rec2(l,mid,L,R);
if (r>R)return rec2(mid+1,r,L,R);
assert(L>=l && R<=r);
return Secret(pref[mid][l],suf[mid][r]);
}
int Query(int L,int R){
return rec2(0,n-1,L,R);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
20048 ms |
2388 KB |
Time limit exceeded |
2 |
Execution timed out |
20068 ms |
2384 KB |
Time limit exceeded |
3 |
Execution timed out |
20042 ms |
2412 KB |
Time limit exceeded |
4 |
Execution timed out |
20084 ms |
4320 KB |
Time limit exceeded |
5 |
Execution timed out |
20062 ms |
4356 KB |
Time limit exceeded |
6 |
Execution timed out |
20076 ms |
4284 KB |
Time limit exceeded |
7 |
Execution timed out |
20094 ms |
4252 KB |
Time limit exceeded |
8 |
Execution timed out |
20090 ms |
4532 KB |
Time limit exceeded |
9 |
Execution timed out |
20069 ms |
4272 KB |
Time limit exceeded |
10 |
Execution timed out |
20052 ms |
4408 KB |
Time limit exceeded |