# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
233708 | 2020-05-21T13:10:41 Z | duality | Just Long Neckties (JOI20_ho_t1) | C++11 | 139 ms | 10104 KB |
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; pii A[200001]; int B[200000],C[200001],ans[200001]; int main() { int i; int N; scanf("%d",&N); for (i = 0; i <= N; i++) scanf("%d",&A[i].first),A[i].second = i; for (i = 0; i < N; i++) scanf("%d",&B[i]); sort(A,A+N+1),sort(B,B+N); int m = 0; for (i = 0; i <= N; i++) { C[i] = max(C[i],m); if (i < N) m = max(m,A[i].first-B[i]); } m = 0; for (i = N; i >= 0; i--) { C[i] = max(C[i],m); if (i > 0) m = max(m,A[i].first-B[i-1]); } for (i = 0; i <= N; i++) ans[A[i].second] = C[i]; for (i = 0; i <= N; i++) printf("%d ",ans[i]); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 432 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 512 KB | Output is correct |
24 | Correct | 6 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 384 KB | Output is correct |
26 | Correct | 6 ms | 384 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 512 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 4 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 6 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 6 ms | 384 KB | Output is correct |
20 | Correct | 6 ms | 432 KB | Output is correct |
21 | Correct | 5 ms | 384 KB | Output is correct |
22 | Correct | 5 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 512 KB | Output is correct |
24 | Correct | 6 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 384 KB | Output is correct |
26 | Correct | 6 ms | 384 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 6 ms | 384 KB | Output is correct |
29 | Correct | 6 ms | 384 KB | Output is correct |
30 | Correct | 6 ms | 512 KB | Output is correct |
31 | Correct | 6 ms | 384 KB | Output is correct |
32 | Correct | 6 ms | 384 KB | Output is correct |
33 | Correct | 129 ms | 9208 KB | Output is correct |
34 | Correct | 139 ms | 9592 KB | Output is correct |
35 | Correct | 129 ms | 9336 KB | Output is correct |
36 | Correct | 131 ms | 9832 KB | Output is correct |
37 | Correct | 138 ms | 10104 KB | Output is correct |
38 | Correct | 134 ms | 10104 KB | Output is correct |
39 | Correct | 132 ms | 9208 KB | Output is correct |
40 | Correct | 132 ms | 9056 KB | Output is correct |
41 | Correct | 134 ms | 9080 KB | Output is correct |
42 | Correct | 132 ms | 9080 KB | Output is correct |
43 | Correct | 132 ms | 9080 KB | Output is correct |
44 | Correct | 130 ms | 8568 KB | Output is correct |
45 | Correct | 129 ms | 8696 KB | Output is correct |
46 | Correct | 134 ms | 8696 KB | Output is correct |
47 | Correct | 113 ms | 8696 KB | Output is correct |
48 | Correct | 117 ms | 8696 KB | Output is correct |
49 | Correct | 137 ms | 9336 KB | Output is correct |
50 | Correct | 139 ms | 9212 KB | Output is correct |
51 | Correct | 135 ms | 9336 KB | Output is correct |
52 | Correct | 136 ms | 9208 KB | Output is correct |
53 | Correct | 138 ms | 9412 KB | Output is correct |