# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745501 | 2023-05-20T08:46:14 Z | sleepntsheep | Just Long Neckties (JOI20_ho_t1) | C++17 | 113 ms | 11596 KB |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, b[N], c[N], p[N], s[N], ans[N]; pair<int, int> a[N]; int main() { scanf("%d", &n); for (int i = 1; i <= n + 1; ++i) scanf("%d", &a[i].first), a[i].second = i; for (int i = 1; i <= n; ++i) scanf("%d", b+i); sort(a+1, a+2+n); sort(b+1, b+1+n); for (int i = 1; i <= n + 1; ++i) c[a[i].second] = i; for (int i = 1; i <= n + 1; ++i) { p[i] = max(p[i-1], max(0, a[i].first - b[i])); } for (int i = n + 1; i >= 1; --i) { s[i] = max(s[i+1], max(0, a[i].first - b[i - 1])); } for (int i = 1; i <= n + 1; ++i) { int j = c[i]; ans[i] = max(p[j-1], s[j+1]); printf("%d ", ans[i]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 312 KB | Output is correct |
16 | Correct | 1 ms | 312 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 320 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 2 ms | 340 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 352 KB | Output is correct |
26 | Correct | 1 ms | 320 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 344 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 340 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 312 KB | Output is correct |
16 | Correct | 1 ms | 312 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 320 KB | Output is correct |
19 | Correct | 1 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 2 ms | 340 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 352 KB | Output is correct |
26 | Correct | 1 ms | 320 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 340 KB | Output is correct |
29 | Correct | 1 ms | 340 KB | Output is correct |
30 | Correct | 1 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 344 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 89 ms | 10600 KB | Output is correct |
34 | Correct | 113 ms | 11064 KB | Output is correct |
35 | Correct | 106 ms | 10752 KB | Output is correct |
36 | Correct | 90 ms | 11272 KB | Output is correct |
37 | Correct | 96 ms | 11596 KB | Output is correct |
38 | Correct | 97 ms | 11424 KB | Output is correct |
39 | Correct | 101 ms | 10428 KB | Output is correct |
40 | Correct | 99 ms | 10396 KB | Output is correct |
41 | Correct | 97 ms | 10544 KB | Output is correct |
42 | Correct | 90 ms | 10548 KB | Output is correct |
43 | Correct | 90 ms | 10396 KB | Output is correct |
44 | Correct | 90 ms | 10060 KB | Output is correct |
45 | Correct | 93 ms | 10124 KB | Output is correct |
46 | Correct | 99 ms | 10032 KB | Output is correct |
47 | Correct | 84 ms | 10088 KB | Output is correct |
48 | Correct | 84 ms | 10216 KB | Output is correct |
49 | Correct | 98 ms | 10764 KB | Output is correct |
50 | Correct | 96 ms | 10832 KB | Output is correct |
51 | Correct | 92 ms | 10728 KB | Output is correct |
52 | Correct | 96 ms | 10684 KB | Output is correct |
53 | Correct | 96 ms | 10752 KB | Output is correct |