# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
321988 |
2020-11-13T16:32:36 Z |
bigg |
Secret (JOI14_secret) |
C++14 |
|
585 ms |
4732 KB |
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
#define esq(x) x << 1
#define dir(x) (x<<1) + 1
#define mid(x,y,t) ((x+y)>>1) + t
struct nodeseg{
int dentro;
bool flag;
nodeseg(int _dentro = 0, bool _flag = 0){
dentro = _dentro;
flag = _flag;
}
nodeseg operator + (nodeseg b){
if(flag && b.flag) return nodeseg(0, 1);
if(flag) return b;
if(b.flag) return *this;
return nodeseg(Secret(dentro, b.dentro), 0);
}
} seg[4*MAXN];
int n;
int a[MAXN];
void build(int node, int x, int y){
if(x == y){
seg[node] = nodeseg(a[x], 0);
return;
}
build(esq(node), x, mid(x,y,0));
build(dir(node), mid(x,y,1), y);
seg[node] = seg[esq(node)] + seg[dir(node)];
}
nodeseg query(int node, int x, int y, int l, int r){
if( x > r || y < l) return nodeseg(0,1);
if(x >= l && y <= r) return seg[node];
nodeseg e = query(esq(node), x, mid(x,y,0), l, r);
nodeseg d = query(dir(node), mid(x,y,1), y, l, r);
return e + d;
}
void Init(int N, int A[]) {
n = N;
for(int i = 1; i <= N; i++) a[i] = A[i-1];
build(1,1,n);
//printf("%d %d\n", tot, maxa);
}
int Query(int L, int R) {
L++;
R++;
return query(1,1,n,L,R).dentro;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
190 ms |
2540 KB |
Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13 |
2 |
Partially correct |
191 ms |
2668 KB |
Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14 |
3 |
Partially correct |
190 ms |
2668 KB |
Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15 |
4 |
Partially correct |
558 ms |
4460 KB |
Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15 |
5 |
Partially correct |
557 ms |
4608 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15 |
6 |
Partially correct |
507 ms |
4448 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4 |
7 |
Partially correct |
584 ms |
4732 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
8 |
Partially correct |
585 ms |
4588 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
9 |
Partially correct |
581 ms |
4608 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |
10 |
Partially correct |
579 ms |
4664 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |