Submission #593259

# Submission time Handle Problem Language Result Execution time Memory
593259 2022-07-10T16:58:05 Z Do_you_copy Secret (JOI14_secret) C++17
0 / 100
422 ms 8308 KB
#include <bits/stdc++.h>
#include "secret.h"
#define taskname "test"
#define fi first
#define se second
#define pb push_back
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
using ll = long long;
using pii = pair <int, int>;
using pil = pair <int, ll>;
using pli = pair <ll, int>;
using pll = pair <ll, ll>;
using ull = unsigned ll;
mt19937 Rand(chrono::steady_clock::now().time_since_epoch().count());

ll min(const ll &a, const ll &b){
    return (a < b) ? a : b;
}

ll max(const ll &a, const ll &b){
    return (a > b) ? a : b;
}

//const ll Mod = 1000000009;
//const ll Mod2 = 999999999989;
//only use when required
const int maxN = 1e3 + 1;

int n;
int cal[maxN][maxN];
int aa[maxN];
int cnt = 0;

void prepare(int l = 0, int r = n - 1){
    if (l > r) return;
    int mid = (l + r) / 2;
    cal[mid][mid] = aa[mid];
    cal[mid + 1][mid + 1] = aa[mid + 1];
    if (l + 1 >= r) return;
    for (int i = mid - 1; i >= l; --i){
        cal[mid][i] = Secret(cal[mid][i + 1], aa[i]);
    }
    for (int i = mid + 2; i <= r; ++i){
        cal[mid + 1][i] = Secret(cal[mid + 1][i - 1], aa[i]);
    }
    prepare(l, mid - 1);
    prepare(mid + 2, r);
}

int Query(int a, int b){
    int l = 0, r = n - 1;
    while (l < r){
        int mid = (l + r) / 2;
        if (a <= mid && mid + 1 <= b) return Secret(cal[mid][a], cal[mid + 1][b]);
        if (mid == b) return cal[b][a];
        if (mid + 1 == a) return cal[a][b];
        if (b < mid) r = mid - 1;
        if (a > mid + 1) l = mid + 2;
    }
    return cal[l][l];
}

void Init(int N, int A[]){
    n = N;
    for (int i = 0; i < n; ++i) aa[i] = A[i];
    prepare();
    //eventually asks 6996 times
}

/*
int main(){
    if (fopen(taskname".inp", "r")){
        freopen(taskname".inp", "r", stdin);
        //freopen(taskname".out", "w", stdout);
    }
    faster;
    ll tt = 1;
    //cin >> tt;
    while (tt--){
        Init();
    }
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 111 ms 4432 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 268854015.
2 Incorrect 116 ms 4428 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 112 ms 4400 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 409 ms 8196 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 414 ms 8204 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 497583184.
6 Incorrect 415 ms 8248 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 302576192.
7 Incorrect 420 ms 8268 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 422 ms 8308 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 416 ms 8160 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 417 ms 8260 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.