Submission #681735

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6817352023-01-14 01:04:24NK_Fortune Telling 2 (JOI14_fortune_telling2)C++17
100 / 100
262 ms63764 KiB
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
using ll = long long;
struct BIT {
vector<int> data; int N;
void init(int n) { N = n; data = vector<int>(N, 0); }
void add(int p, int x) { for(++p;p<=N;p+=p&-p) data[p-1] += x; }
int sum(int l, int r) { return sum(r+1) - sum(l); }
int sum(int r) { int s = 0; for(;r;r-=r&-r) s += data[r-1]; return s; }
};
struct ST {
int level(int x) { return 31 - __builtin_clz(x); }
int comb(int a, int b) { return max(a, b); }
vector<int> v; vector<vector<int>> jmp;
void init(const vector<int> &_v) {
v = _v; jmp = {v};
for(int j = 1; (1<<j) <= int(size(v)); j++) {
jmp.push_back(vector<int>(int(size(v)) - (1<<j) + 1));
for(int i = 0; i < int(size(jmp[j])); i++) {
jmp[j][i] = comb(jmp[j-1][i], jmp[j-1][i + (1<<(j-1))]);
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...