# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
853101 | faruk | Election (BOI18_election) | C++17 | 1182 ms | 262144 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>
#define mp make_pair
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
struct node {
int sum, min_val;
};
void merge_node(node &t, node &a, node &b) {t.sum = a.sum + b.sum, t.min_val = min(b.min_val, a.min_val + b.sum);}
struct seggy{
vector<node> t; int n;
seggy(int N) {
n = pow(2, ceil(log(N)/log(2))); t.resize(2*n, {0, 0});
}
int get() {return t[1].min_val;}
void upd(int idx, int n_val) {
for (idx += n, t[idx] = {n_val, min(0, n_val)}, idx /= 2; idx > 0; idx /= 2)
merge_node(t[idx], t[idx*2], t[idx*2+1]);
}
};
const int K = 500;
bool cmp(pair<pii, int> a, pair<pii, int> b) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |