답안 #223011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223011 2020-04-14T13:38:00 Z aggu_01000101 비밀 (JOI14_secret) C++14
0 / 100
20000 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(l>mid(l, u)) return query(mid(l, u)+1, u, rchild(i), ll, uu);
    if(u<=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);
}
//-2 4 5 5 6 8
//8 -2 6 4 5 5
//5 5 4 6 -2 8

Compilation message

secret.cpp:1:20: warning: extra tokens at end of #include directive
 #include "secret.h"=
                    ^
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 20037 ms 4344 KB Time limit exceeded
2 Execution timed out 20073 ms 4472 KB Time limit exceeded
3 Execution timed out 20051 ms 4600 KB Time limit exceeded
4 Execution timed out 20035 ms 8312 KB Time limit exceeded
5 Execution timed out 20048 ms 8204 KB Time limit exceeded
6 Execution timed out 20068 ms 8184 KB Time limit exceeded
7 Execution timed out 20018 ms 8184 KB Time limit exceeded
8 Execution timed out 20092 ms 8184 KB Time limit exceeded
9 Execution timed out 20063 ms 8184 KB Time limit exceeded
10 Execution timed out 20085 ms 8184 KB Time limit exceeded