# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
756786 | Dan4Life | Event Hopping 2 (JOI21_event2) | C++17 | 243 ms | 20084 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 pb push_back
#define all(a) begin(a),end(a)
const int N = (int)2e5+5, Lg = 17;
int n, k;
vector<int> v;
set<pair<int,int>> S;
int L[N], R[N], J[Lg][N*2];
int get(int l, int r){
int T = 0;
for(int i = Lg-1; i>=0; i--)
if(J[i][l]<=r) l=J[i][l], T+=(1<<i);
return T;
}
int main(){
cin >> n >> k;
for(int i = 1; i <= n; i++)
cin >> L[i] >> R[i], v.pb(L[i]), v.pb(R[i]);
sort(all(v)); v.erase(unique(all(v)),end(v));
int m = v.size();
for(int i = 0; i <= m; i++) J[0][i]=m;
for(int i = 1; i <= n; i++){
L[i] = lower_bound(all(v),L[i])-begin(v);
R[i] = lower_bound(all(v),R[i])-begin(v);
J[0][L[i]] = min(J[0][L[i]],R[i]);
}
for(int i = m-1; i>=0; i--)
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... |