# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
991233 | model_code | Flooding Wall (BOI24_wall) | C++17 | 1693 ms | 63520 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.
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n;
vector<long long> powers_of_2;
vector<int> values;
struct Node {
// sum[0] represents the sum of right(p)+1, sum[1] represents the sum of (-left(p)).
long long sum[2] = {0, 0};
// For each type of calculation (right and left), the number of times the value is to be multiplied by 2 and by 0.
long long update[2][2] = {{0, 0},
{0, 0}};
long long GetValue(int index) {
// If we have multiplication by zero, the answer is also zero.
if (update[index][0])return 0;
return powers_of_2[update[index][1]] * sum[index] % mod;
}
};
vector<Node> nodes;
void RefreshNode(int node, int index) {
nodes[node].sum[index] = (nodes[node * 2 + 1].GetValue(index) + nodes[node * 2 + 2].GetValue(index)) % mod;
}
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... |