# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
293213 |
2020-09-07T18:50:02 Z |
XmtosX |
Secret (JOI14_secret) |
C++17 |
|
591 ms |
4600 KB |
#include <bits/stdc++.h>;
#include "secret.h"
using namespace std;
#define LL pos*2+1
#define RR pos*2+2
const int NN=1e3+3;
int seg[NN*4],a[NN],n,l,r;
void build (int st,int en,int pos)
{
if (st==en)
{
seg[pos]=a[st];
return;
}
int mid= (st+en)/2;
build(st,mid,LL);
build(mid+1,en,RR);
seg[pos]=Secret(seg[LL],seg[RR]);
}
int query(int st,int en,int pos)
{
if (st>=l&&en<=r)
return seg[pos];
int mid=(st+en)/2;
int p1=-1,p2=-1;
if (!(st>r||mid<l))
p1=query(st,mid,LL);
if (!(mid+1>r||en<l))
p2=query(mid+1,en,RR);
if (p1==-1)
return p2;
if (p2==-1)
return p1;
return Secret(p1,p2);
}
void Init(int N, int A[])
{
n=N;
for (int i=0;i<n;i++)
a[i]=A[i];
build(0,n-1,0);
}
int Query(int L, int R)
{
l=L;
r=R;
int ans=query(0,n-1,0);
return ans;
}
/*
8
1 4 7 2 5 8 3 6
4
0 3
1 7
5 5
2 4
*/
Compilation message
secret.cpp:1:25: warning: extra tokens at end of #include directive
1 | #include <bits/stdc++.h>;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
189 ms |
2424 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 |
187 ms |
2424 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 |
189 ms |
2584 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 |
554 ms |
4600 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 |
561 ms |
4472 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 |
516 ms |
4472 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 |
590 ms |
4556 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 |
589 ms |
4472 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 |
582 ms |
4600 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 |
591 ms |
4600 KB |
Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16 |