# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
53183 | okaybody10 | 비밀 (JOI14_secret) | C++98 | 681 ms | 8636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
int n,B[1006],ans[1006][1006];
void _fill(int s, int e){
int m=(s+e)/2;
if(s==e){
ans[m][m]=B[m];
return;
}
ans[m][m]=B[m];
for(int x=m-1; x>=s; x--){
ans[x][m]=Secret(B[x], ans[x+1][m]);
}
ans[m+1][m+1]=B[m+1];
for(int y=m+2; y<=e; y++)
ans[m+1][y]=Secret(ans[m+1][y-1], B[y]);
_fill(s,m);
_fill(m+1,e);
}
void Init(int N, int A[]) {
n=N;
for(int i=0; i<n; i++) B[i]=A[i];
_fill(0,n-1);
}
int solve(int l, int r, int s, int e){
int m=(s+e)/2;
if(l<=m && m+1<=r){
return Secret(ans[l][m], ans[m+1][r]);
}
if(r<=m) return solve(l,r,s,m);
else return solve(l,r,m+1,e);
}
int Query(int l, int r) {
if(l==r) return B[l];
return solve(l,r,0,n-1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |