# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70252 | MladenP | 비밀 (JOI14_secret) | C++17 | 662 ms | 8624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "secret.h"
#define m (l+r)/2
#define G return
#define s Secret
int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)G;for(int i=m+1;i<=r;i++)d[m][i]=s(d[m][i-1],a[i]);for(int i=m-2;i>=l;i--)d[i][m-1]=Secret(a[i],d[i+1][m-1]);Z(l,m-1);Z(m+1, r);}void Init(int N,int A[]){for(i=1,n=N;i<=n;i++)a[i]=A[i-1],d[i][i]=a[i];Z(1,N);}int Q(int l,int r,int L,int R){if(L<m&&m<=R)G Secret(d[L][m-1],d[m][R]);if(L==m)G d[m][R];if(m<L)G Q(m+1,r,L,R);G Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |