| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 7006 | gs13068 | 비밀 (JOI14_secret) | C++98 | 656 ms | 169116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "secret.h"
static int a[2048];
static int s[20480];
static int e[20480];
int l[20480][1024];
int r[20480][1024];
static void calc(int x)
{
if(e[x]-s[x]>1)
{
int i,j,m=(s[x]+e[x])>>1;
j=a[m-1];
l[x][m-1]=j;
for(i=m-2;i>=s[x];i--)
{
j=Secret(a[i],j);
l[x][i]=j;
}
j=a[m];
r[x][m]=j;
for(i=m+1;i<e[x];i++)
{
j=Secret(j,a[i]);
r[x][i]=j;
}
s[x<<1]=s[x];
e[x<<1]=m;
calc(x<<1);
s[(x<<1)+1]=m;
e[(x<<1)+1]=e[x];
calc((x<<1)+1);
}
}
static int get(int x,int L,int R)
{
if(L==R)return a[L];
int m=(s[x]+e[x])>>1;
if(L<m&&m<=R)return Secret(l[x][L],r[x][R]);
if(R<m)return get(x<<1,L,R);
return get((x<<1)+1,L,R);
}
void Init(int N, int A[])
{
int i;
for(i=0;i<N;i++)a[i]=A[i];
s[1]=0;
e[1]=1000;
calc(1);
}
int Query(int L, int R)
{
return get(1,L,R);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
