# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1170610 | lopkus | Trampoline (info1cup20_trampoline) | C++20 | 2096 ms | 26544 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<int> next(n + 1, 0);
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<int>> jump(n + 1, std::vector<int>(21));
for(int i = 1; i <= n; i++) {
jump[i][0] = next[i];
}
for(int j = 1; j < 20; j++){
for(int i = 1; i <= n; i++){
jump[i][j] = jump[jump[i][j - 1]][j - 1];
}
# | 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... |