# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1112421 | n3rm1n | Event Hopping (BOI22_events) | C++17 | 0 ms | 0 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 int MAXN = 1e5 + 10;
void speed()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
struct pus
{
int s, e, index;
pus(){};
pus(int _s, int _e, int _index)
{
s = _s;
e = _e;
index = _index;
}
};
int n, q;
int s[MAXN], e[MAXN], maxt = 0;
unordered_map < int, int > mp;
vector < int > p;
int t[MAXN * 4];
void make_tree(int i, int l, int r)
{
t[i] = 1e9;
if(l == r)return;
int mid = (l + r)/2;
make_tree(2*i, l, mid);
make_tree(2*i+1, mid+1, r);
}
int val, x;
void update(int i, int l, int r)
{
if(l == r)
{
t[i] = min(t[i], val);
return;
}
int mid = (l + r)/2;
if(x <= mid)update(2*i, l, mid);
else update(2*i+1, mid+1, r);
t[i] = min(t[2*i], t[2*i+1]);
}
int ql, qr;
int query(int i, int l, int r)
{
if(qr < l || ql > r)return 1e9;
if(ql <= l && r <= qr)return t[i];
int mid = (l + r)/2;
return min(query(2*i, l, mid), query(2*i+1, mid+1, r));
}
void read()
{
cin >> n >> q;
vector < int > g;
for (int i = 1; i <= n; ++ i)
{
cin >> s[i] >> e[i];
g.push_back(s[i]);
g.push_back(e[i]);
}
sort(g.begin(), g.end());
int last = -1;
for (auto x: g)
{
if(last == x)continue;
maxt ++;
mp[x] = maxt;
last = x;
}
for (int i = 1; i <= n; ++ i)
{
s[i] = mp[s[i]];
t[i] = mp[t[i]];
p.push_back(pus(s[i], e[i], i));
}
sort(p.begin(), p.end(), cmp);
}
void solve()
{
for (auto &[s, e, i]: p)
{
}
}
int main()
{
speed();
read();
return 0;
}