Submission #407587

# Submission time Handle Problem Language Result Execution time Memory
407587 2021-05-19T03:52:26 Z kwongweng Secret (JOI14_secret) C++17
0 / 100
530 ms 4460 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second

vi arr[1000];
int n;
vi a(1000);

void build(int l, int r){
    if (l == r){
        arr[l].pb(l); return;
    }
    int m = (l+r)/2;
    build(l, m);
    build(m+1, r);
    arr[m].pb(a[m]);
    int cnt = 0;
    ROF(i, m-1, l){
        arr[m].pb(Secret(arr[m][cnt], a[i]));
        cnt++;
    }
    arr[m+1].pb(a[m+1]);
    cnt = 0;
    FOR(i, m+2, r+1){
        arr[m+1].pb(Secret(arr[m+1][cnt], a[i]));
        cnt++;
    }
}

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

int query(int tl, int tr, int l, int r){
    int tm = (tl + tr) / 2;
    if (l > tm+1) return query(tm+1, tr, l, r);
    if (r < tm) return query(tl, tm, l, r);
    if (l == tm+1) return arr[l][r-l];
    if (r == tm) return arr[r][r-l];
    return Secret(arr[tm][tm-l], arr[tm+1][r-tm-1]);
}
int Query(int L, int R) {
    return query(0, n-1, L, R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 133 ms 2460 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 810641201.
2 Incorrect 141 ms 2452 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 71996801.
3 Incorrect 143 ms 2416 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 624066638.
4 Incorrect 514 ms 4428 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 78775023.
5 Incorrect 504 ms 4380 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 134745364.
6 Incorrect 526 ms 4460 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 915.
7 Incorrect 516 ms 4392 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 607126601.
8 Incorrect 524 ms 4364 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 675468304.
9 Incorrect 530 ms 4440 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 810823552.
10 Incorrect 512 ms 4408 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 336937350.