# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
556103 |
2022-05-02T11:04:26 Z |
urosk |
Secret (JOI14_secret) |
C++14 |
|
492 ms |
8272 KB |
#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) return c[l][r];
if(l>=mid) 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;
}
/*
8
1 4 7 2 5 8 3 6
4
0 3
1 7
5 5
2 4
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
125 ms |
4424 KB |
Wrong Answer: Query(113, 206) - expected : 536899947, actual : 536870912. |
2 |
Incorrect |
119 ms |
4436 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 0. |
3 |
Incorrect |
136 ms |
4388 KB |
Wrong Answer: Query(334, 369) - expected : 363022362, actual : 536870912. |
4 |
Incorrect |
471 ms |
8172 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912. |
5 |
Incorrect |
455 ms |
8272 KB |
Wrong Answer: Query(263, 292) - expected : 653448456, actual : 536870912. |
6 |
Incorrect |
450 ms |
8224 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 536870912. |
7 |
Correct |
482 ms |
8168 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
484 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 |
461 ms |
8244 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
492 ms |
8192 KB |
Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1 |