# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954443 | TAhmed33 | Event Hopping (BOI22_events) | C++98 | 1576 ms | 7508 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 + 25;
const int B = 18;
int dp[B][MAXN];
int n, q;
pair <int, int> a[MAXN];
int jump (int a, int b) {
for (int i = B - 1; i >= 0; i--) {
if (b & (1 << i)) {
a = dp[i][a];
}
}
return a;
}
int main () {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> q;
for (int i = 1; i <= n; i++) {
cin >> a[i].first >> a[i].second;
}
for (int i = 1; i <= n; i++) {
dp[0][i] = i;
for (int j = 1; j <= n; j++) {
if (a[j].second >= a[i].first && a[j].second <= a[i].second) {
if (a[j].first < a[dp[0][i]].first) dp[0][i] = j;
}
}
}
for (int i = 1; i < B; i++) {
# | 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... |