# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
776414 | peuch | Election Campaign (JOI15_election_campaign) | C++17 | 136 ms | 41296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
Idea:
Represent C[i] in base K.
Seg:
Each node will save the representation in base K as a vector with the sum of values in each power.
Merging is in O(log) by adding the vectors.
Operation 1 is a point update changing the vector of a leaf node and recalculating the ancestors.
Operation 2 is a lazy range update that will make seg[pos][i] = segp[pos][i + 1]
Operation 3 is a range query by merging of range nodes and then computing the final value.
O(Qlog(N)^2)
Confidence 7/10
*/
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
int n, q, k;
int v[MAXN];
vector<int> seg[4 * MAXN];
int lz[4 * MAXN];
void refresh(int pos, int ini, int fim);
void build(int pos, int ini, int fim);
void updatePoint(int pos, int ini, int fim, int id, int val);
Compilation message (stderr)
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |