# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
622601 | 2022-08-04T12:17:10 Z | cheissmart | Sky Walking (IOI19_walk) | C++14 | 160 ms | 21604 KB |
#include "walk.h" #include <bits/stdc++.h> #define F first #define S second #define V vector #define MP make_pair #define EB emplace_back #define PB push_back #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7, N = 1e5 + 7; const ll oo = 1e18; vi asr[N], asl[N]; ll min_distance(vi x, vi h, vi l, vi r, vi y, int s, int g) { int n = SZ(x); if(s != 0 || g != n - 1) return 0LL; int m = SZ(l); for(int i = 0; i < m; i++) { asl[l[i]].PB(y[i]); asr[r[i]].PB(y[i]); } map<int, ll> mp; mp[0] = 0; asr[0].PB(0); for(int i = 0; i < n; i++) { set<int> no; for(int yy:asl[i]) { no.insert(yy); auto it = mp.lower_bound(yy); ll d = oo; if(it != mp.end()) d = min(d, it -> S + abs(yy - it -> F)); if(it != mp.begin()) { it--; d = min(d, it -> S + abs(yy - it -> F)); } mp[yy] = d; } if(i < n - 1) for(int yy:asr[i]) { if(no.count(yy)) continue; mp.erase(yy); } if(mp.empty()) return -1; } ll ans = oo; for(auto[yy, d]:mp) ans = min(ans, d + yy); return ans + x[n - 1] - x[0]; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 7188 KB | Output is correct |
2 | Correct | 84 ms | 10524 KB | Output is correct |
3 | Correct | 92 ms | 11488 KB | Output is correct |
4 | Correct | 126 ms | 17228 KB | Output is correct |
5 | Correct | 141 ms | 21536 KB | Output is correct |
6 | Correct | 132 ms | 19668 KB | Output is correct |
7 | Correct | 62 ms | 13644 KB | Output is correct |
8 | Correct | 83 ms | 19120 KB | Output is correct |
9 | Correct | 127 ms | 20896 KB | Output is correct |
10 | Correct | 114 ms | 20260 KB | Output is correct |
11 | Correct | 11 ms | 6544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 7188 KB | Output is correct |
2 | Correct | 84 ms | 10524 KB | Output is correct |
3 | Correct | 92 ms | 11488 KB | Output is correct |
4 | Correct | 126 ms | 17228 KB | Output is correct |
5 | Correct | 141 ms | 21536 KB | Output is correct |
6 | Correct | 132 ms | 19668 KB | Output is correct |
7 | Correct | 62 ms | 13644 KB | Output is correct |
8 | Correct | 83 ms | 19120 KB | Output is correct |
9 | Correct | 127 ms | 20896 KB | Output is correct |
10 | Correct | 114 ms | 20260 KB | Output is correct |
11 | Correct | 11 ms | 6544 KB | Output is correct |
12 | Correct | 92 ms | 11352 KB | Output is correct |
13 | Correct | 78 ms | 16776 KB | Output is correct |
14 | Correct | 160 ms | 21604 KB | Output is correct |
15 | Correct | 99 ms | 17036 KB | Output is correct |
16 | Correct | 94 ms | 17160 KB | Output is correct |
17 | Correct | 111 ms | 17236 KB | Output is correct |
18 | Correct | 97 ms | 17056 KB | Output is correct |
19 | Correct | 105 ms | 17156 KB | Output is correct |
20 | Correct | 69 ms | 13636 KB | Output is correct |
21 | Correct | 23 ms | 8572 KB | Output is correct |
22 | Correct | 89 ms | 14956 KB | Output is correct |
23 | Correct | 84 ms | 15232 KB | Output is correct |
24 | Correct | 83 ms | 16660 KB | Output is correct |
25 | Correct | 80 ms | 15112 KB | Output is correct |
26 | Correct | 92 ms | 19224 KB | Output is correct |
27 | Correct | 157 ms | 21132 KB | Output is correct |
28 | Correct | 66 ms | 16716 KB | Output is correct |
29 | Correct | 139 ms | 19404 KB | Output is correct |
30 | Correct | 63 ms | 13572 KB | Output is correct |
31 | Correct | 155 ms | 20908 KB | Output is correct |
32 | Correct | 82 ms | 17968 KB | Output is correct |
33 | Correct | 87 ms | 19324 KB | Output is correct |
34 | Correct | 106 ms | 18348 KB | Output is correct |
35 | Correct | 90 ms | 17152 KB | Output is correct |
36 | Correct | 71 ms | 16608 KB | Output is correct |
37 | Correct | 66 ms | 16008 KB | Output is correct |
38 | Correct | 82 ms | 18332 KB | Output is correct |
39 | Correct | 94 ms | 19708 KB | Output is correct |
40 | Correct | 71 ms | 17924 KB | Output is correct |
41 | Correct | 68 ms | 16296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 4948 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |