Submission #223038

# Submission time Handle Problem Language Result Execution time Memory
223038 2020-04-14T14:34:41 Z aggu_01000101 Secret (JOI14_secret) C++14
0 / 100
652 ms 8312 KB
#include "secret.h"
#define mid(l, u) ((l+u)/2)
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
using namespace std;
int DP[1000][1000];
int segtree[4000];
int n;
int build(int l, int u, int i, int a[]){
    if(l==u) return DP[l][u] = segtree[i] = a[l];
    return DP[l][u] = segtree[i] = Secret(build(l, mid(l, u), lchild(i), a), build(mid(l, u)+1, u, rchild(i), a));
}
int query(int l, int u, int i, int ll, int uu){
    if(DP[ll][uu]>-1) return DP[ll][uu];
    if(l>=ll && u<=uu) return segtree[i];
    if(ll>mid(l, u)) return query(mid(l, u)+1, u, rchild(i), ll, uu);
    if(uu<=mid(l, u)) return query(l, mid(l, u), lchild(i), ll, uu);
    return DP[ll][uu] = Secret(query(l, mid(l, u), lchild(i), ll, mid(l, u)), query(mid(l, u)+1, u, rchild(i), mid(l, u)+1, uu));
}
void Init(int N, int A[]){
    n = N;
    for(int i = 0;i<n;i++){
        for(int j = 0;j<n;j++) DP[i][j] = -1;
    }
    for(int i = 0;i<n;i++){
        for(int j = i+1;j<n;j++){
            query(0, n-1, 0, i, j);
        }
    }
    build(0, n-1, 0, A);
}
int Query(int L, int R){
    return query(0, n-1, 0, L, R);
}
# Verdict Execution time Memory Grader output
1 Incorrect 169 ms 4344 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 536870912.
2 Incorrect 169 ms 4344 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 0.
3 Incorrect 170 ms 4344 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 536870912.
4 Incorrect 634 ms 8240 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 536870912.
5 Incorrect 652 ms 8312 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 536870912.
6 Incorrect 639 ms 8312 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 536870912.
7 Incorrect 632 ms 8188 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 0.
8 Incorrect 629 ms 8312 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 536870912.
9 Incorrect 630 ms 8184 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 0.
10 Incorrect 634 ms 8312 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 0.