| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 376324 | cheissmart | Secret (JOI14_secret) | C++14 | 524 ms | 4588 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "secret.h"
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << "Line(" << __LINE__ << ") -> " << #x << " is " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;
const int INF = 1e9 + 7, N = 1005;
int n, *a;
int t[N][11];
void build(int l = 0, int r = n, int depth = 0) {
if(r - l == 1) return;
int m = (l + r) / 2;
t[m - 1][depth] = a[m - 1];
for(int i = m - 2; i >= l; i--)
t[i][depth] = Secret(a[i], t[i + 1][depth]);
t[m][depth] = a[m];
for(int i = m + 1; i < r; i++)
t[i][depth] = Secret(t[i - 1][depth], a[i]);
build(l, m, depth + 1);
build(m, r, depth + 1);
}
void Init(int N, int A[]) {
n = N, a = A;
build(0, n);
}
int qry(int l, int r, int tl = 0, int tr = n, int depth = 0) {
int tm = (tl + tr) / 2;
if(l < tm && r >= tm) return Secret(t[l][depth], t[r][depth]);
else if(r < tm) return qry(l, r, tl, tm, depth + 1);
else return qry(l, r, tm, tr, depth + 1);
}
int Query(int l, int r) {
if(l == r) return a[l];
return qry(l, r);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
