# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1037053 | 2024-07-28T00:37:01 Z | HappyCapybara | Sky Walking (IOI19_walk) | C++17 | 4000 ms | 702616 KB |
#include "walk.h" #include<bits/stdc++.h> using namespace std; #define ll long long ll min_distance(vector<int> x, vector<int> h, vector<int> l, vector<int> r, vector<int> y, int s, int g){ int n = x.size(), m = l.size(); vector<vector<pair<int,int>>> sws(n, {{0, m}}); for (int i=0; i<m; i++){ for (int j=l[i]; j<=r[i]; j++){ if (y[i] <= h[j]) sws[j].push_back({y[i], i}); } } y.push_back(0); for (int i=0; i<n; i++) sort(sws[i].begin(), sws[i].end()); map<ll,vector<int>> pn; for (int i=0; i<n; i++){ if (sws[i].size() == 0) continue; for (int j=0; j<sws[i].size(); j++){ if (j < sws[i].size()-1) pn[i*100001+sws[i][j].second].push_back(sws[i][j+1].second); if (j > 0) pn[i*100001+sws[i][j].second].push_back(sws[i][j-1].second); } } priority_queue<vector<ll>> pq; unordered_set<ll> seen; pq.push({0, s, m}); while (!pq.empty()){ ll d = -pq.top()[0]; int bld = pq.top()[1], sw = pq.top()[2]; pq.pop(); //cout << d << " " << bld << " " << sw << "\n"; if (bld == g && sw == m) return d; if (seen.find(bld*100001+sw) != seen.end()) continue; seen.insert(bld*100001+sw); for (int next : pn[bld*100001+sw]) pq.push({-(d+abs(y[next]-y[sw])), bld, next}); if (sw == m) continue; for (int next=l[sw]; next<=r[sw]; next++){ if (next != bld && h[next] >= y[sw]) pq.push({-(d+abs(x[next]-x[bld])), next, sw}); } } return -1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 692 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 0 ms | 436 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 4 ms | 744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 289 ms | 91072 KB | Output is correct |
4 | Incorrect | 1156 ms | 131356 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 21744 KB | Output is correct |
2 | Execution timed out | 4056 ms | 702616 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 21744 KB | Output is correct |
2 | Execution timed out | 4056 ms | 702616 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 432 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 692 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 1 ms | 604 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 604 KB | Output is correct |
11 | Correct | 0 ms | 436 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 344 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 4 ms | 744 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 289 ms | 91072 KB | Output is correct |
21 | Incorrect | 1156 ms | 131356 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |