#include "secret.h"
#include <bits/stdc++.h>
#define MAXN 1007
using namespace std;
int val[MAXN][MAXN],a[MAXN],n;
void rek(int l,int r)
{
int s=(l+r)/2;
val[s][s]=a[s];
for(int i=s-1;i>=l;i--) val[i][s]=Secret(a[i],val[i+1][s]);
val[s+1][s+1]=a[s+1];
for(int i=s+1;i<=r;i++) val[s+1][i]=Secret(val[s+1][i-1],a[i]);
if(l==r) return;
rek(l,s);
rek(s+1,r);
}
void Init(int N, int A[])
{
n=N;
for(int i=0;i<n;i++) a[i]=A[i];
rek(0,n-1);
}
int ans(int l,int r,int lt,int rt)
{
int s=(l+r)/2;
if(lt<=s && rt>s) return Secret(val[lt][s],val[s+1][rt]);
if(rt<=s) return ans(l,s,lt,rt);
return ans(s+1,r,lt,rt);
}
int Query(int L, int R) {return ans(0,n-1,L,R);}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
173 ms |
4600 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 34031537. |
2 |
Incorrect |
168 ms |
4724 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 569483529. |
3 |
Incorrect |
169 ms |
4852 KB |
Wrong Answer: Query(67, 224) - expected : 202440844, actual : 739311628. |
4 |
Incorrect |
616 ms |
8848 KB |
Wrong Answer: Query(727, 872) - expected : 870334875, actual : 870334619. |
5 |
Incorrect |
631 ms |
9056 KB |
Wrong Answer: Query(761, 790) - expected : 112945480, actual : 112871752. |
6 |
Execution timed out |
20057 ms |
9144 KB |
Time limit exceeded |
7 |
Incorrect |
672 ms |
9288 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
8 |
Incorrect |
625 ms |
9324 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
9 |
Incorrect |
634 ms |
9404 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |
10 |
Incorrect |
626 ms |
9532 KB |
Output isn't correct - number of calls to Secret by Init = 8977, maximum number of calls to Secret by Query = 1 |