Submission #54647

# Submission time Handle Problem Language Result Execution time Memory
54647 2018-07-04T10:54:42 Z junhopark Secret (JOI14_secret) C++14
30 / 100
743 ms 4824 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
typedef long long LL;
int n, a[1005], tree[4005];
void start(int si, int ei, int ind)
{
    if (si==ei) {
        tree[ind] = a[si];
        return;
    }
    int mi=(si+ei)>>1;
    start(si, mi, ind<<1);
    start(mi+1, ei, ind<<1|1);
    tree[ind] = Secret(tree[ind<<1], tree[ind<<1|1]);
}
void Init(int N, int A[])
{
    int i;
    n = N;
    for (i=1; i<=n; i++) a[i]=A[i-1];
    start(1, n, 1);
}
int get_ans(int si, int ei, int s, int e, int ind)
{
    if (si>e||ei<s) return -1;
    if (si>=s&&ei<=e) return tree[ind];
    int mi = (si+ei)>>1, l, r;
    l = get_ans(si, mi, s, e, ind<<1);
    r = get_ans(mi+1, ei, s, e, ind<<1|1);
    if (l<0&&r<0) return -1;
    if (l<0) return r;
    if (r<0) return l;
    return Secret(l, r);
}
int Query(int L, int R)
{
    return get_ans(1, n, L+1, R+1, 1);
}
# Verdict Execution time Memory Grader output
1 Partially correct 230 ms 2364 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 225 ms 2536 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 229 ms 2680 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 655 ms 4540 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 668 ms 4692 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 599 ms 4692 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 743 ms 4692 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 734 ms 4692 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 703 ms 4692 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 729 ms 4824 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16