# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
297676 | penguinhacker | 비밀 (JOI14_secret) | C++17 | 525 ms | 4504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "secret.h"
using namespace std;
/*int Secret(int a, int b) {
return min(a, b);
}*/
const int mxN = 1000, mxK = 12;
int n, a[mxN];
int tl[mxN][mxK], tr[mxN][mxK];
void Init(int N, int A[]) {
n = N;
for (int i = 0; i < n; ++i) {
a[i] = A[i];
}
for (int j = 0; (1 << j) <= n; ++j) {
int mask = (1 << j) - 1;
int temp;
for (int i = 0; i < n; ++i) {
temp = ((i & mask) == 0) ? a[i] : Secret(temp, a[i]);
tl[i][j] = temp;
}
for (int i = n - 1; ~i; --i) {
temp = ((i & mask) == mask || i == n - 1) ? a[i] : Secret(a[i], temp);
tr[i][j] = temp;
}
}
}
int Query(int L, int R) {
if (L == R) return a[L];
int x = 31 - __builtin_clz(L ^ R);
return Secret(tr[L][x], tl[R][x]);
}
/*int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int a[3] = {2, 1, 3};
Init(3, a);
for (int i = 0; i < 3; ++i) for (int j = i; j < 3; ++j) cout << i << " " << j << " " << Query(i, j) << "\n";
return 0;
}*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |