답안 #293192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293192 2020-09-07T18:07:47 Z fucking_do_it 비밀 (JOI14_secret) C++14
30 / 100
608 ms 4672 KB
#include "secret.h"
#include <bits/stdc++.h>
#define le node+node
#define ri node+node+1
#define mid (l+r)/2
using namespace std;
const int inf = 1e3+9;
int n,a[inf],tree[inf<<2],cnt = 0;
vector<int> tmp;

void build(int node,int l,int r){
    if(l == r)
        return void(tree[node] = a[l]);

    build(le,l,mid);
    build(ri,mid+1,r);
    tree[node] = Secret(tree[le],tree[ri]);
    cnt++;
}

void query(int node,int l,int r,int x,int y){
    if(l>r || r<x || l>y)
        return ;
    if(l>=x && r<=y)
        return void(tmp.push_back(tree[node]));

    query(le,l,mid,x,y);
    query(ri,mid+1,r,x,y);
}

void Init(int N, int A[]) {
    n = N;
    for(int i=1;i<=n;i++)
        a[i] = A[i-1];
    build(1,1,n);
        assert(cnt<=8000);

}

int Query(int L, int R) {
    cnt = 0;
    tmp.clear();
    query(1,1,n,L+1,R+1);
    for(int i=tmp.size()-1;i>0;i--)
        tmp[i-1] = Secret(tmp[i-1],tmp[i]),cnt++;
    assert(cnt <= 20);
    return tmp[0];
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 199 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 196 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 195 ms 2556 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 584 ms 4472 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 577 ms 4540 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 524 ms 4404 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 603 ms 4512 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 608 ms 4672 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 598 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 607 ms 4472 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16