# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
383253 | ritul_kr_singh | Railway (BOI17_railway) | C++17 | 606 ms | 35936 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;
#define int long long
#define sp << " " <<
#define nl << "\n"
struct segtree{
int sz = 1;
vector<bool> a;
segtree(int n){
while(sz < n) sz *= 2;
a.assign(2*sz, false);
}
void update(int i, int x, int lx, int rx){
if(rx-lx==1) return void(a[x] = !a[x]);
int mx = (lx+rx)/2;
if(i<mx) update(i, 2*x+1, lx, mx);
else update(i, 2*x+2, mx, rx);
a[x] = max(a[2*x+1], a[2*x+2]);
}
void update(int i){ update(i, 0, 0, sz); }
bool get(int l, int r, int x, int lx, int rx){
if(r<=lx or rx<=l) return false;
if(l<=lx and rx<=r) return a[x];
int mx = (lx+rx)/2;
return get(l, r, 2*x+1, lx, mx) or get(l, r, 2*x+2, mx, rx);
}
bool get(int l, int r){ return get(l, r+1, 0, 0, sz); }
};
# | 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... |