# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
247425 | receed | Secret (JOI14_secret) | C++14 | 523 ms | 9056 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "secret.h"
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;
const int N = 1000, L = 9;
int d[L][N];
void Init(int n, int a[]) {
for (int i = 0; (1 << i) <= n; i++) {
int pw = 1 << i;
for (int j = pw; j <= n; j += pw * 2) {
d[i][j - 1] = a[j - 1];
if (j < n)
d[i][j] = a[j];
for (int k = j - 2; k >= j - pw; k--)
d[i][k] = Secret(a[k], d[i][k + 1]);
for (int k = j + 1; k < min(n, j + pw); k++)
d[i][k] = Secret(d[i][k - 1], a[k]);
}
}
}
int Query(int l, int r) {
if (l == r)
return d[0][l];
int x = l ^ r, pos = 0;
while ((2 << pos) <= x)
pos++;
return Secret(d[pos][l], d[pos][r]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |