Submission #366266

# Submission time Handle Problem Language Result Execution time Memory
366266 2021-02-13T17:34:05 Z rocks03 Secret (JOI14_secret) C++14
0 / 100
521 ms 5164 KB
//#pragma GCC target("avx2")
//#pragma GCC optimization("O3")
//#pragma GCC optimization("unroll-loops")
#include "secret.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define Re(i, a, b) for(int i = (a); i >= (b); i--)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

map<pii, int> memo;
int Secret(int x, int y);
int queries = 0;
const int MAXQ = 8000;
int ask(int x, int y){
    if(memo.count({x, y}))
        return memo[{x, y}];
    queries++;
    if(queries > MAXQ) return 0;
    memo[{x, y}] = Secret(x, y);
    return memo[{x, y}];
}

const int MAXK = 10;
const int MAXN = 1e3;
int *a, st[MAXK][MAXN];

void Init(int N, int A[]){
    a = A;
    rep(i, 0, N){
        st[0][i] = a[i];
    }
    rep(k, 0, MAXK - 1){
        rep(i, 0, N + 1 - (1 << (k + 1))){
            st[k + 1][i] = ask(st[k][i], st[k][i + (1 << k)]);
        }
    }
}

int Query(int L, int R){
    int ans = INT_MAX;
    Re(k, MAXK - 1, 0){
        if((R - L + 1) >> k & 1){
            if(ans == INT_MAX) ans = st[k][L];
            else ans = ask(ans, st[k][L]);
            L += (1 << k);
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 144 ms 3056 KB Wrong Answer: Query(185, 247) - expected : 541471996, actual : 0.
2 Incorrect 141 ms 3052 KB Wrong Answer: Query(181, 387) - expected : 594649385, actual : 0.
3 Incorrect 144 ms 3180 KB Wrong Answer: Query(220, 254) - expected : 419891338, actual : 0.
4 Incorrect 509 ms 5164 KB Wrong Answer: Query(646, 883) - expected : 879461085, actual : 0.
5 Incorrect 502 ms 4900 KB Wrong Answer: Query(778, 858) - expected : 761955600, actual : 0.
6 Incorrect 521 ms 5064 KB Wrong Answer: Query(695, 703) - expected : 168798085, actual : 0.
7 Incorrect 500 ms 4984 KB Wrong Answer: Query(49, 977) - expected : 88218643, actual : 0.
8 Incorrect 504 ms 4884 KB Wrong Answer: Query(89, 914) - expected : 293933208, actual : 0.
9 Incorrect 501 ms 4964 KB Wrong Answer: Query(115, 979) - expected : 143667207, actual : 0.
10 Incorrect 514 ms 5100 KB Wrong Answer: Query(49, 970) - expected : 275146573, actual : 0.