# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
556891 | 2022-05-04T10:04:45 Z | hibiki | Just Long Neckties (JOI20_ho_t1) | C++11 | 120 ms | 10824 KB |
#include<bits/stdc++.h> using namespace std; #define PB push_back #define F first #define S second int n; int fl[200200],fr[200200],ans[200200]; vector<int> od; vector<pair<int,int> > nw; int main() { scanf("%d",&n); od.resize(n); nw.resize(n+1); for(int i=0;i<n+1;i++) scanf("%d",&nw[i].F),nw[i].S=i+1; for(int i=0;i<n;i++) scanf("%d",&od[i]); sort(nw.begin(),nw.end()); sort(od.begin(),od.end()); for(int i=0;i<n;i++) { fl[i]=max(nw[i].F-od[i],0); if(i) fl[i]=max(fl[i],fl[i-1]); } ans[nw[n].S]=fl[n-1]; for(int i=n-1;i>=0;i--) { fr[i]=max(nw[i+1].F-od[i],0); if(i<n-1) fr[i]=max(fr[i],fr[i+1]); if(i) ans[nw[i].S]=max(fl[i-1],fr[i]); } ans[nw[0].S]=fr[0]; for(int i=1;i<=n+1;i++) printf("%d ",ans[i]); printf("\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 308 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 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 | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 308 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 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 | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 312 KB | Output is correct |
14 | Correct | 1 ms | 320 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 2 ms | 340 KB | Output is correct |
19 | Correct | 1 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 | 1 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 340 KB | Output is correct |
27 | Correct | 2 ms | 340 KB | Output is correct |
28 | Correct | 2 ms | 320 KB | Output is correct |
29 | Correct | 2 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 364 KB | Output is correct |
32 | Correct | 2 ms | 320 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 1 ms | 308 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 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 | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 312 KB | Output is correct |
14 | Correct | 1 ms | 320 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 328 KB | Output is correct |
18 | Correct | 2 ms | 340 KB | Output is correct |
19 | Correct | 1 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 | 1 ms | 340 KB | Output is correct |
23 | Correct | 2 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 340 KB | Output is correct |
27 | Correct | 2 ms | 340 KB | Output is correct |
28 | Correct | 2 ms | 320 KB | Output is correct |
29 | Correct | 2 ms | 340 KB | Output is correct |
30 | Correct | 2 ms | 340 KB | Output is correct |
31 | Correct | 2 ms | 364 KB | Output is correct |
32 | Correct | 2 ms | 320 KB | Output is correct |
33 | Correct | 97 ms | 9944 KB | Output is correct |
34 | Correct | 95 ms | 10312 KB | Output is correct |
35 | Correct | 91 ms | 9964 KB | Output is correct |
36 | Correct | 97 ms | 10592 KB | Output is correct |
37 | Correct | 93 ms | 10824 KB | Output is correct |
38 | Correct | 101 ms | 10668 KB | Output is correct |
39 | Correct | 98 ms | 9680 KB | Output is correct |
40 | Correct | 102 ms | 9740 KB | Output is correct |
41 | Correct | 94 ms | 9760 KB | Output is correct |
42 | Correct | 93 ms | 9744 KB | Output is correct |
43 | Correct | 93 ms | 9724 KB | Output is correct |
44 | Correct | 120 ms | 9316 KB | Output is correct |
45 | Correct | 90 ms | 9332 KB | Output is correct |
46 | Correct | 90 ms | 9312 KB | Output is correct |
47 | Correct | 88 ms | 9372 KB | Output is correct |
48 | Correct | 93 ms | 9416 KB | Output is correct |
49 | Correct | 98 ms | 9968 KB | Output is correct |
50 | Correct | 93 ms | 9972 KB | Output is correct |
51 | Correct | 97 ms | 9976 KB | Output is correct |
52 | Correct | 99 ms | 9976 KB | Output is correct |
53 | Correct | 97 ms | 9928 KB | Output is correct |