# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335618 | 2020-12-13T10:15:44 Z | Joshc | Just Long Neckties (JOI20_ho_t1) | C++11 | 135 ms | 17620 KB |
#include <cstdio> #include <vector> #include <algorithm> using namespace std; #define ll long long ll x[200002], y[200002], ans[200002], c; int main() { int n; vector<pair<ll, ll> > a; vector<ll> b; scanf("%d", &n); for (int i=0; i<=n; i++) { scanf("%lld", &c); a.emplace_back(c, i); } sort(a.begin(), a.end()); for (int i=0; i<n; i++) { scanf("%lld", &c); b.push_back(c); } sort(b.begin(), b.end()); for (int i=1; i<=n; i++) { x[i] = max(a[i-1].first-b[i-1], x[i-1]); y[i] = max(a[n-i+1].first-b[n-i], y[i-1]); } for (int i=0; i<=n; i++) ans[a[i].second] = max(x[i], y[n-i]); for (int i=0; i<=n; i++) printf("%lld ", ans[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 492 KB | Output is correct |
18 | Correct | 2 ms | 492 KB | Output is correct |
19 | Correct | 2 ms | 492 KB | Output is correct |
20 | Correct | 2 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 492 KB | Output is correct |
22 | Correct | 1 ms | 492 KB | Output is correct |
23 | Correct | 1 ms | 492 KB | Output is correct |
24 | Correct | 1 ms | 492 KB | Output is correct |
25 | Correct | 2 ms | 492 KB | Output is correct |
26 | Correct | 2 ms | 504 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 492 KB | Output is correct |
29 | Correct | 2 ms | 492 KB | Output is correct |
30 | Correct | 2 ms | 492 KB | Output is correct |
31 | Correct | 2 ms | 492 KB | Output is correct |
32 | Correct | 2 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 2 ms | 492 KB | Output is correct |
18 | Correct | 2 ms | 492 KB | Output is correct |
19 | Correct | 2 ms | 492 KB | Output is correct |
20 | Correct | 2 ms | 492 KB | Output is correct |
21 | Correct | 2 ms | 492 KB | Output is correct |
22 | Correct | 1 ms | 492 KB | Output is correct |
23 | Correct | 1 ms | 492 KB | Output is correct |
24 | Correct | 1 ms | 492 KB | Output is correct |
25 | Correct | 2 ms | 492 KB | Output is correct |
26 | Correct | 2 ms | 504 KB | Output is correct |
27 | Correct | 2 ms | 512 KB | Output is correct |
28 | Correct | 2 ms | 492 KB | Output is correct |
29 | Correct | 2 ms | 492 KB | Output is correct |
30 | Correct | 2 ms | 492 KB | Output is correct |
31 | Correct | 2 ms | 492 KB | Output is correct |
32 | Correct | 2 ms | 492 KB | Output is correct |
33 | Correct | 127 ms | 16468 KB | Output is correct |
34 | Correct | 128 ms | 17128 KB | Output is correct |
35 | Correct | 123 ms | 16596 KB | Output is correct |
36 | Correct | 130 ms | 17108 KB | Output is correct |
37 | Correct | 129 ms | 17620 KB | Output is correct |
38 | Correct | 133 ms | 17364 KB | Output is correct |
39 | Correct | 127 ms | 16468 KB | Output is correct |
40 | Correct | 126 ms | 16340 KB | Output is correct |
41 | Correct | 125 ms | 16468 KB | Output is correct |
42 | Correct | 124 ms | 16468 KB | Output is correct |
43 | Correct | 126 ms | 16468 KB | Output is correct |
44 | Correct | 122 ms | 15956 KB | Output is correct |
45 | Correct | 127 ms | 16232 KB | Output is correct |
46 | Correct | 135 ms | 15956 KB | Output is correct |
47 | Correct | 125 ms | 16212 KB | Output is correct |
48 | Correct | 121 ms | 16232 KB | Output is correct |
49 | Correct | 128 ms | 16864 KB | Output is correct |
50 | Correct | 129 ms | 16852 KB | Output is correct |
51 | Correct | 128 ms | 16980 KB | Output is correct |
52 | Correct | 129 ms | 16852 KB | Output is correct |
53 | Correct | 130 ms | 16852 KB | Output is correct |