| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 520006 | amunduzbaev | 비밀 (JOI14_secret) | C++14 | 455 ms | 16236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "secret.h"
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif
const int M = 1000;
int a[M];
int ask(int a, int b){
if(a == -1) return b;
if(b == -1) return a;
return Secret(a, b);
}
struct ST{
int pref[M<<2][M], suff[M<<2][M];
void build(int lx = 0, int rx = M, int x = 1){
if(lx == rx) { pref[x][0] = a[lx]; return; }
int m = (lx + rx) >> 1;
pref[x][0] = a[m];
for(int i=1;i<=m-lx;i++){
pref[x][i] = ask(pref[x][i-1], a[m-i]);
}
suff[x][0] = a[m+1];
for(int i=1;i<=rx-m-1;i++){
suff[x][i] = ask(suff[x][i-1], a[m+1+i]);
}
build(lx, m, x<<1);
build(m+1, rx, x<<1|1);
}
int get(int l, int r, int lx = 0, int rx = M, int x = 1){
if(lx == rx) return a[lx];
int m = (lx + rx) >> 1;
if(r <= m) return get(l, r, lx, m, x<<1);
if(m < l) return get(l, r, m+1, rx, x<<1|1);
return ask(pref[x][m-l], suff[x][r-m-1]);
}
}tree;
void Init(int N, int A[]) {
for(int i=0;i<N;i++){
a[i] = A[i];
}
tree.build();
}
int Query(int L, int R) {
return tree.get(L, R);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
