#include <bits/stdc++.h>
#include "secret.h"
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define fi first
#define se second
#define INF 1e9
#define eps 1e-7
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9+7;
const int nax = 1005;
int n;
vi s;
int t[nax][nax];
void solve(int l, int r){
if(l >= r-1) return;
int md = (l+r)/2;
t[md][md] = s[md];
t[md+1][md+1] = s[md+1];
//cout << l << " " << r << endl;
for (int i = md+2; i <= r; ++i)
{
t[md+1][i] = Secret(t[md+1][i-1],s[i]);
//cout << i << endl;
}
for (int i = md-1; i >= l; --i)
{
t[i][md] = Secret(t[i+1][md],s[i]);
//cout << i << endl;
}
if(l < md) solve(l,md);
if(md +1 < r) solve(md+1,r);
}
void Init(int N, int A[]){
n = N;
for (int i = 0; i < N; ++i)
{
s.pb(A[i]);
}
solve(0,n-1);
}
int Query(int L, int R){
int l = 0, r = n-1;
int md = (l+r)/2;
while(l != r){
md = (l+r)/2;
if(md >= L && md < R) return Secret(t[L][md],t[md+1][R]);
else if(md == R) return t[L][md];
else if(md > R)
r = md;
else
l = md+1;
}
return t[l][l];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
109 ms |
4484 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673. |
2 |
Incorrect |
110 ms |
4376 KB |
Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560. |
3 |
Incorrect |
112 ms |
4300 KB |
Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500. |
4 |
Incorrect |
428 ms |
8128 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568. |
5 |
Incorrect |
424 ms |
8204 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316. |
6 |
Incorrect |
410 ms |
8096 KB |
Wrong Answer: Query(250, 258) - expected : 907404, actual : 997709. |
7 |
Incorrect |
420 ms |
8144 KB |
Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873. |
8 |
Incorrect |
420 ms |
8136 KB |
Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792. |
9 |
Incorrect |
412 ms |
8168 KB |
Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577. |
10 |
Incorrect |
433 ms |
8280 KB |
Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787. |