# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203056 | 2020-02-19T06:47:15 Z | blacktulip | Just Long Neckties (JOI20_ho_t1) | C++17 | 365 ms | 17916 KB |
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define int long long #define mp make_pair #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo MAX = -1000000000000000000; const lo MIN = 1000000000000000000; const lo inf = 1000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 500005; const lo mod = 1000000007; int n,m,a[li],k,flag,t,ans[li]; int cev; PII p[li]; string s; multiset<int> st; vector<int> v; main(void){ scanf("%lld",&n); for(int i=1;i<=n+1;i++){ scanf("%lld",&p[i].fi); p[i].se=i; } FOR{ scanf("%lld",&a[i]); } sort(a+1,a+n+1); sort(p+1,p+n+2); FOR st.insert((a[i]-p[i].fi)); for(int i=n+1;i>=1;i--){ if(i==n+1){ ans[p[i].se]=*st.begin(); } else{ auto it=st.find(-(p[i].fi-a[i])); st.erase(it); st.insert(-(p[i+1].fi-a[i])); ans[p[i].se]=*st.begin(); } } for(int i=1;i<=n+1;i++) printf("%lld ",-ans[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 380 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 380 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 6 ms | 376 KB | Output is correct |
15 | Correct | 6 ms | 504 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 504 KB | Output is correct |
18 | Correct | 6 ms | 504 KB | Output is correct |
19 | Correct | 6 ms | 504 KB | Output is correct |
20 | Correct | 7 ms | 504 KB | Output is correct |
21 | Correct | 8 ms | 504 KB | Output is correct |
22 | Correct | 6 ms | 504 KB | Output is correct |
23 | Correct | 6 ms | 504 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 7 ms | 504 KB | Output is correct |
26 | Correct | 6 ms | 504 KB | Output is correct |
27 | Correct | 7 ms | 504 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 7 ms | 504 KB | Output is correct |
32 | Correct | 7 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 380 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 6 ms | 376 KB | Output is correct |
15 | Correct | 6 ms | 504 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 504 KB | Output is correct |
18 | Correct | 6 ms | 504 KB | Output is correct |
19 | Correct | 6 ms | 504 KB | Output is correct |
20 | Correct | 7 ms | 504 KB | Output is correct |
21 | Correct | 8 ms | 504 KB | Output is correct |
22 | Correct | 6 ms | 504 KB | Output is correct |
23 | Correct | 6 ms | 504 KB | Output is correct |
24 | Correct | 6 ms | 504 KB | Output is correct |
25 | Correct | 7 ms | 504 KB | Output is correct |
26 | Correct | 6 ms | 504 KB | Output is correct |
27 | Correct | 7 ms | 504 KB | Output is correct |
28 | Correct | 6 ms | 504 KB | Output is correct |
29 | Correct | 6 ms | 504 KB | Output is correct |
30 | Correct | 6 ms | 504 KB | Output is correct |
31 | Correct | 7 ms | 504 KB | Output is correct |
32 | Correct | 7 ms | 504 KB | Output is correct |
33 | Correct | 264 ms | 16736 KB | Output is correct |
34 | Correct | 274 ms | 17508 KB | Output is correct |
35 | Correct | 261 ms | 16888 KB | Output is correct |
36 | Correct | 255 ms | 17400 KB | Output is correct |
37 | Correct | 267 ms | 17916 KB | Output is correct |
38 | Correct | 260 ms | 17912 KB | Output is correct |
39 | Correct | 309 ms | 16760 KB | Output is correct |
40 | Correct | 312 ms | 16784 KB | Output is correct |
41 | Correct | 322 ms | 16760 KB | Output is correct |
42 | Correct | 326 ms | 16760 KB | Output is correct |
43 | Correct | 321 ms | 16632 KB | Output is correct |
44 | Correct | 298 ms | 16376 KB | Output is correct |
45 | Correct | 312 ms | 16248 KB | Output is correct |
46 | Correct | 310 ms | 16252 KB | Output is correct |
47 | Correct | 203 ms | 16504 KB | Output is correct |
48 | Correct | 201 ms | 16508 KB | Output is correct |
49 | Correct | 337 ms | 17272 KB | Output is correct |
50 | Correct | 352 ms | 17144 KB | Output is correct |
51 | Correct | 338 ms | 17416 KB | Output is correct |
52 | Correct | 343 ms | 17144 KB | Output is correct |
53 | Correct | 365 ms | 17272 KB | Output is correct |