# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
957462 |
2024-04-03T19:37:30 Z |
FEDIKUS |
Secret (JOI14_secret) |
C++17 |
|
394 ms |
4480 KB |
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
map<pair<int,int>,int> prec;
int *a;
int n;
void dc(int l,int r){
if(l==r){
prec[{l,l}]=a[l];
return;
}
int mid=l+(r-l)/2;
int tren=a[mid+1];
prec[{mid+1,mid+1}]=tren;
for(int i=mid+2;i<=r;i++){
tren=Secret(tren,a[i]);
prec[{mid+1,i}]=tren;
}
tren=a[mid];
for(int i=mid-1;i>=l;i--){
tren=Secret(a[i],tren);
prec[{i,mid}]=tren;
}
}
void Init(int nn, int aa[]) {
n=nn;
a=aa;
dc(0,n-1);
}
int result(int tl,int tr,int l=0,int r=n-1){
int mid=l+(r-l)/2;
if(l<=mid && mid<r){
return Secret(prec[{tl,mid}],prec[{mid+1,tr}]);
}else if(r<=mid){
return result(tl,tr,l,mid);
}else return result(tl,tr,mid+1,r);
}
int Query(int l, int r) {
if(l==r) return a[l];
return result(l,r);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
99 ms |
2904 KB |
Wrong Answer: Query(222, 254) - expected : 34031541, actual : 587620235. |
2 |
Incorrect |
97 ms |
2652 KB |
Wrong Answer: Query(102, 157) - expected : 32612619, actual : 962726377. |
3 |
Incorrect |
105 ms |
2648 KB |
Wrong Answer: Query(334, 369) - expected : 363022362, actual : 547672410. |
4 |
Incorrect |
367 ms |
4432 KB |
Wrong Answer: Query(90, 497) - expected : 397934825, actual : 846921768. |
5 |
Incorrect |
371 ms |
4480 KB |
Wrong Answer: Query(587, 915) - expected : 752404486, actual : 212882718. |
6 |
Incorrect |
383 ms |
4344 KB |
Wrong Answer: Query(738, 741) - expected : 983692994, actual : 423176097. |
7 |
Correct |
382 ms |
4336 KB |
Output is correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 1 |
8 |
Correct |
382 ms |
4432 KB |
Output is correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 1 |
9 |
Correct |
390 ms |
4472 KB |
Output is correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 1 |
10 |
Correct |
394 ms |
4432 KB |
Output is correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 1 |