Submission #735739

# Submission time Handle Problem Language Result Execution time Memory
735739 2023-05-04T14:15:56 Z sandry24 Secret (JOI14_secret) C++17
6 / 100
8161 ms 4448 KB
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
 
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

int n;
const int maxn = 1005;
int st[4*maxn];

int secret(int x, int y){
    return (x + 2 * (y / 2));
}

int combine(int x, int y){
    if(x == -1)
        return y;
    else if(y == -1)
        return x;
    else
        return Secret(x, y);
}

void build(int v, int tl, int tr, int A[]){
    if(tl == tr){
        st[v] = A[tl];
    } else {
        int tm = (tl+tr)/2;
        build(v*2, tl, tm, A);
        build(v*2+1, tm+1, tr, A);
        st[v] = Secret(st[v*2], st[v*2+1]);
    }
}

int range_query(int v, int tl, int tr, int l, int r){
    if(l > r)
        return -1;
    if(tl == tr)
        return st[v];
    int tm = (tl+tr)/2;
    return combine(range_query(v*2, tl, tm, l, min(tm, r)), 
        range_query(2*v+1, tm+1, tr, max(tm+1, l), r));
}

int Query(int L, int R){
    return range_query(1, 0, n-1, L, R);
}

void Init(int N, int A[]){
    n = N;
    build(1, 0, n-1, A);
}

int query(int l, int r, vi &a){
    if(l == r)
        return a[l];
    int current = secret(a[l], a[l+1]);
    for(int i = l+2; i <= r; i++){
        current = secret(current, a[i]);
    }
    return current;
}
# Verdict Execution time Memory Grader output
1 Partially correct 1591 ms 2560 KB Output isn't correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 506
2 Partially correct 1546 ms 2460 KB Output isn't correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 508
3 Partially correct 1555 ms 2520 KB Output isn't correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 505
4 Partially correct 3357 ms 4372 KB Output isn't correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 997
5 Partially correct 3373 ms 4424 KB Output isn't correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 992
6 Partially correct 477 ms 4328 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 10
7 Partially correct 8161 ms 4364 KB Output isn't correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 999
8 Partially correct 7758 ms 4448 KB Output isn't correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 999
9 Partially correct 7759 ms 4368 KB Output isn't correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 998
10 Partially correct 7677 ms 4428 KB Output isn't correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 999