# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
293794 | staniewzki | 늑대인간 (IOI18_werewolf) | C++17 | 1398 ms | 63080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#include "werewolf.h"
struct RMQ {
vector<vector<int>> st;
vector<int> pre;
function<int(int, int)> f;
RMQ(vector<int> &a, function<int(int, int)> f) : f(f) {
int n = size(a), lg = 0;
while((1 << lg) < n) lg++;
st.resize(lg + 1, vector<int>(a));
st[0] = a;
FOR(i, 1, lg) REP(j, n) {
st[i][j] = st[i - 1][j];
int q = j + (1 << (i - 1));
if(q < n) st[i][j] = f(st[i][j], st[i - 1][q]);
}
pre.resize(n + 1);
FOR(i, 2, n) pre[i] = pre[i / 2] + 1;
}
int operator()(int l, int r) {
if(l > r) swap(l, r);
int q = pre[r - l + 1], x = r - (1 << q) + 1;
return f(st[q][l], st[q][x]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |