# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1170606 | lopkus | Trampoline (info1cup20_trampoline) | C++20 | 2096 ms | 42992 KiB |
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int r, c, n;
std::cin >> r >> c >> n;
std::vector<std::pair<int,int>> a(n + 1);
for(int i = 1; i <= n; i++) {
std::cin >> a[i].first >> a[i].second;
}
std::sort(a.begin() + 1, a.end());
std::map<std::pair<int,int>, int> M;
std::vector<int64_t> next(n + 1, 1e9 + 5);
for(int i = 1; i <= n; i++) {
for(int j = i + 1; j <= n; j++) {
if(a[i].first + 1 == a[j].first && a[i].second <= a[j].second) {
next[i] = j;
break;
}
}
}
std::vector<std::vector<int64_t>> jump(n + 1, std::vector<int64_t>(21));
for(int i = n; i >= 1; i--) {
jump[i][0] = next[i];
for(int bit = 1; bit < 21; bit++) {
int jump1 = jump[i][bit - 1];
if(jump1 > n) {
break;
}
# | 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... |