# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
566969 | 2022-05-23T06:56:23 Z | Dodo | Just Long Neckties (JOI20_ho_t1) | C++14 | 111 ms | 11644 KB |
#include <bits/stdc++.h> #define ll long long #define endl '\n' #define pb push_back using namespace std; const ll mx=1007, INF=1e18L+5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll n; cin>>n; ll b[n]; vector<pair<ll,ll>>v(n+1); for(int i=0;i<=n;i++) { ll x; cin>>x; v[i]={x,i}; } for(int i=0;i<n;i++)cin>>b[i]; sort(v.begin(),v.end()); sort(b,b+n); ll p1[n],p2[n]; ll mx=0; for(int i=0;i<n;i++) { mx=max(mx,v[i].first-b[i]); p1[i]=mx; } mx=0; for(int i=n;i>=1;i--) { mx=max(mx,v[i].first-b[i-1]); p2[i-1]=mx; } ll f[n+1]; for(int i=0;i<=n;i++) { ll x,y,ans=0; if(i-1>=0)ans=max(ans,p1[i-1]); if(i!=n)ans=max(ans,p2[i]); f[v[i].second]=ans; } for(int i=0;i<=n;i++)cout<<f[i]<<' '; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 412 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 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 | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 412 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 1 ms | 340 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 | 1 ms | 340 KB | Output is correct |
32 | Correct | 1 ms | 340 KB | Output is correct |
33 | Correct | 83 ms | 10684 KB | Output is correct |
34 | Correct | 96 ms | 11124 KB | Output is correct |
35 | Correct | 91 ms | 10844 KB | Output is correct |
36 | Correct | 93 ms | 11252 KB | Output is correct |
37 | Correct | 108 ms | 11644 KB | Output is correct |
38 | Correct | 89 ms | 11464 KB | Output is correct |
39 | Correct | 87 ms | 10572 KB | Output is correct |
40 | Correct | 90 ms | 10552 KB | Output is correct |
41 | Correct | 87 ms | 10544 KB | Output is correct |
42 | Correct | 91 ms | 10612 KB | Output is correct |
43 | Correct | 95 ms | 10508 KB | Output is correct |
44 | Correct | 86 ms | 10156 KB | Output is correct |
45 | Correct | 99 ms | 10200 KB | Output is correct |
46 | Correct | 92 ms | 10152 KB | Output is correct |
47 | Correct | 83 ms | 10252 KB | Output is correct |
48 | Correct | 89 ms | 10256 KB | Output is correct |
49 | Correct | 111 ms | 10788 KB | Output is correct |
50 | Correct | 111 ms | 10860 KB | Output is correct |
51 | Correct | 97 ms | 10880 KB | Output is correct |
52 | Correct | 104 ms | 10784 KB | Output is correct |
53 | Correct | 101 ms | 10772 KB | Output is correct |