# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
625469 | 2022-08-10T12:10:01 Z | Augustyn | Just Long Neckties (JOI20_ho_t1) | C++14 | 133 ms | 10836 KB |
#include<bits/stdc++.h> using namespace std; int n,suf[200002],pref[200002]; pair<int,int>a[200002]; int b[200001],odp[200002]; int main() { scanf("%d",&n); for(int i=0;i<=n;++i) { scanf("%d",&a[i].first); a[i].second=i; } for(int i=0;i<n;++i) { scanf("%d",&b[i]); } sort(a,a+(n+1)); sort(b,b+n); for(int i=n-1;i>=0;--i) suf[i]=max(suf[i+1],a[i+1].first-b[i]); pref[0]=max(0,a[0].first-b[0]); for(int i=1;i<n;++i) pref[i]=max(pref[i-1],a[i].first-b[i]); for(int i=1;i<=n;++i) odp[a[i].second]=max(pref[i-1],suf[i]); odp[a[0].second]=suf[0]; for(int i=0;i<=n;++i) printf("%d ",odp[i]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 5 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 308 KB | Output is correct |
9 | Correct | 1 ms | 312 KB | Output is correct |
10 | Correct | 1 ms | 308 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 5 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 308 KB | Output is correct |
9 | Correct | 1 ms | 312 KB | Output is correct |
10 | Correct | 1 ms | 308 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 | 360 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 320 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 356 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 2 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 2 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 316 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 | 316 KB | Output is correct |
31 | Correct | 1 ms | 316 KB | Output is correct |
32 | Correct | 2 ms | 320 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 5 ms | 304 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 304 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 308 KB | Output is correct |
9 | Correct | 1 ms | 312 KB | Output is correct |
10 | Correct | 1 ms | 308 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 | 360 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 320 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 2 ms | 356 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 2 ms | 340 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 2 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 340 KB | Output is correct |
24 | Correct | 2 ms | 340 KB | Output is correct |
25 | Correct | 2 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 340 KB | Output is correct |
27 | Correct | 1 ms | 316 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 | 316 KB | Output is correct |
31 | Correct | 1 ms | 316 KB | Output is correct |
32 | Correct | 2 ms | 320 KB | Output is correct |
33 | Correct | 107 ms | 9864 KB | Output is correct |
34 | Correct | 111 ms | 10376 KB | Output is correct |
35 | Correct | 89 ms | 9932 KB | Output is correct |
36 | Correct | 103 ms | 10440 KB | Output is correct |
37 | Correct | 97 ms | 10836 KB | Output is correct |
38 | Correct | 110 ms | 10692 KB | Output is correct |
39 | Correct | 99 ms | 9680 KB | Output is correct |
40 | Correct | 119 ms | 9648 KB | Output is correct |
41 | Correct | 113 ms | 9872 KB | Output is correct |
42 | Correct | 95 ms | 9688 KB | Output is correct |
43 | Correct | 133 ms | 9628 KB | Output is correct |
44 | Correct | 119 ms | 9228 KB | Output is correct |
45 | Correct | 98 ms | 9420 KB | Output is correct |
46 | Correct | 126 ms | 9260 KB | Output is correct |
47 | Correct | 117 ms | 9356 KB | Output is correct |
48 | Correct | 121 ms | 9420 KB | Output is correct |
49 | Correct | 98 ms | 9984 KB | Output is correct |
50 | Correct | 101 ms | 10024 KB | Output is correct |
51 | Correct | 117 ms | 9964 KB | Output is correct |
52 | Correct | 99 ms | 10004 KB | Output is correct |
53 | Correct | 96 ms | 9932 KB | Output is correct |