#include "secret.h"
#define here cerr<<"===========================================\n"
#include <bits/stdc++.h>
#define ld double
#define ll long long
#define ull unsigned long long
#define llinf 100000000000000000LL // 10^17
#define iinf 2000000000 // 2*10^9
#define pb push_back
#define popb pop_back
#define fi first
#define sc second
#define endl '\n'
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
#define sz(a) int(a.size())
#define all(a) a.begin(),a.end()
#define ceri(a,l,r) {for(ll i_ = l;i_<=r;i_++) cerr<<a[i_]<< " ";cerr<<endl;}
using namespace std;
#define maxn 1005
int a[maxn];
int c[maxn][maxn];
int n;
void init(int l,int r){
if(l>=r) return;
int mid = (l+r)/2;
for(int i = mid+1;i<=r;i++) c[mid][i] = Secret(c[mid][i-1],a[i]);
for(int i = mid-2;i>=l;i--) c[i][mid-1] = Secret(a[i],c[i+1][mid-1]);
init(l,mid-1);
init(mid+1,r);
}
void Init(int N, int A[]) {
n = N;
for(int i = 1;i<=n;i++) a[i] = A[i-1];
for(int i = 1;i<=n;i++) c[i][i] = a[i];
init(1,n);
}
int get(int tl,int tr,int l,int r){
if(l==r) return c[l][r];
int mid = (tl+tr)/2;
if(mid-1>=l&&mid<=r) return Secret(c[l][mid-1],c[mid][r]);
if(l>=mid+1) return get(mid+1,tr,l,r);
return get(tl,mid-2,l,r);
}
int Query(int L, int R) {
int ans = get(1,n,L+1,R+1);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
20038 ms |
4428 KB |
Time limit exceeded |
2 |
Incorrect |
120 ms |
4396 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 0. |
3 |
Incorrect |
120 ms |
4484 KB |
Wrong Answer: Query(334, 369) - expected : 363022362, actual : 536870912. |
4 |
Incorrect |
458 ms |
8196 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912. |
5 |
Incorrect |
440 ms |
8272 KB |
Wrong Answer: Query(263, 292) - expected : 653448456, actual : 536870912. |
6 |
Incorrect |
447 ms |
8236 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 536870912. |
7 |
Correct |
498 ms |
8324 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
443 ms |
8184 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
509 ms |
8288 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
466 ms |
8360 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |