# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
950985 | 2024-03-21T03:29:28 Z | Trisanu_Das | Sky Walking (IOI19_walk) | C++17 | 4000 ms | 106868 KB |
#include <bits/stdc++.h> #include "walk.h" using namespace std; #define ii pair<int,int> vector<int>E[100000], B[100000]; vector<ii> adj[100000]; long long min_distance(std::vector<int> x, std::vector<int> h, std::vector<int> l, std::vector<int> r, std::vector<int> y, int s, int g) { map<int, int> curr; priority_queue<pair<long long, ii>> Q; map<ii, long long> val; set<ii> vis; for(int i = 0; i < r.size(); i++){ E[r[i]].push_back(y[i]); B[l[i]].push_back(y[i]); } for(int i = 0; i < x.size(); i++){ for(auto& Y : curr){ if(Y.first > h[i]) break; adj[i].push_back({Y.second, Y.first}); adj[Y.second].push_back({i, Y.first}); Y.second = i; } for(auto Y : E[i]) curr.erase(Y); for(auto Y : B[i]) curr[Y] = i; } val[{s, 0}] = 0; Q.push({0, {s, 0}}); while(!Q.empty()){ ii p = Q.top().second; Q.pop(); if(vis.count(p)) continue; vis.insert(p); for(auto y : adj[p.first]){ if(vis.count(y) || (val.count(y) && val[y] <= val[p] + abs(p.second - y.second) + abs(x[p.first] - x[y.first]))) continue; val[y] = val[p] + abs(p.second - y.second) + abs(x[p.first] - x[y.first]); Q.push({-val[y], y}); } } long long ans = 1e18; for(auto p : val){ if(p.first.first == g) ans = min(ans, p.second + p.first.second); } if(ans == 1e18) return -1; return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7256 KB | Output is correct |
2 | Correct | 2 ms | 7256 KB | Output is correct |
3 | Correct | 3 ms | 7260 KB | Output is correct |
4 | Correct | 2 ms | 7260 KB | Output is correct |
5 | Correct | 4 ms | 7512 KB | Output is correct |
6 | Correct | 3 ms | 7768 KB | Output is correct |
7 | Correct | 3 ms | 7512 KB | Output is correct |
8 | Correct | 3 ms | 7516 KB | Output is correct |
9 | Correct | 2 ms | 7260 KB | Output is correct |
10 | Correct | 5 ms | 7516 KB | Output is correct |
11 | Correct | 3 ms | 7260 KB | Output is correct |
12 | Correct | 3 ms | 7260 KB | Output is correct |
13 | Correct | 3 ms | 7260 KB | Output is correct |
14 | Correct | 2 ms | 7260 KB | Output is correct |
15 | Correct | 2 ms | 7260 KB | Output is correct |
16 | Correct | 2 ms | 7260 KB | Output is correct |
17 | Correct | 6 ms | 7516 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7260 KB | Output is correct |
2 | Correct | 2 ms | 7260 KB | Output is correct |
3 | Execution timed out | 4067 ms | 56964 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 100 ms | 18244 KB | Output is correct |
2 | Execution timed out | 4101 ms | 106868 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 100 ms | 18244 KB | Output is correct |
2 | Execution timed out | 4101 ms | 106868 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 7256 KB | Output is correct |
2 | Correct | 2 ms | 7256 KB | Output is correct |
3 | Correct | 3 ms | 7260 KB | Output is correct |
4 | Correct | 2 ms | 7260 KB | Output is correct |
5 | Correct | 4 ms | 7512 KB | Output is correct |
6 | Correct | 3 ms | 7768 KB | Output is correct |
7 | Correct | 3 ms | 7512 KB | Output is correct |
8 | Correct | 3 ms | 7516 KB | Output is correct |
9 | Correct | 2 ms | 7260 KB | Output is correct |
10 | Correct | 5 ms | 7516 KB | Output is correct |
11 | Correct | 3 ms | 7260 KB | Output is correct |
12 | Correct | 3 ms | 7260 KB | Output is correct |
13 | Correct | 3 ms | 7260 KB | Output is correct |
14 | Correct | 2 ms | 7260 KB | Output is correct |
15 | Correct | 2 ms | 7260 KB | Output is correct |
16 | Correct | 2 ms | 7260 KB | Output is correct |
17 | Correct | 6 ms | 7516 KB | Output is correct |
18 | Correct | 2 ms | 7260 KB | Output is correct |
19 | Correct | 2 ms | 7260 KB | Output is correct |
20 | Execution timed out | 4067 ms | 56964 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |