# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61661 | gs14004 | Election (BOI18_election) | C++17 | 1841 ms | 88572 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;
using pi = pair<int, int>;
using lint = long long;
const int MAXN = 500005;
const int MAXT = 1050000;
int a[MAXN], nxt[19][MAXN], edg[19][MAXN];
char str[MAXN];
vector<pi> v;
struct seg{
int tree[MAXT], lim;
void init(int n, int *a){
for(lim = 1; lim <= n; lim <<= 1);
fill(tree, tree + MAXT, -1e9);
for(int i=0; i<n; i++) tree[i + lim] = a[i];
for(int i=lim-1; i; i--) tree[i] = max(tree[2*i], tree[2*i+1]);
}
int query(int s, int e){
s += lim;
e += lim;
int ret = -1e9;
while(s < e){
if(s % 2 == 1) ret = max(ret, tree[s++]);
if(e % 2 == 0) ret = max(ret, tree[e--]);
s >>= 1;
e >>= 1;
}
if(s == e) ret = max(ret, tree[s]);
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... |