Submission #548965

# Submission time Handle Problem Language Result Execution time Memory
548965 2022-04-14T20:50:44 Z beaconmc Just Long Neckties (JOI20_ho_t1) PyPy 3
100 / 100
437 ms 74136 KB
n = int(input())

ties = list(map(int, input().split()))
realsus = list(ties)

employees = list(map(int, input().split()))
ties.sort()
employees.sort()
tiesmap = dict()
for i in range(len(ties)):
    tiesmap[ties[i]] = i

sussies = dict()


max1 = [ties[i]-employees[i] for i in range(n)]
max2 = [ties[i]-employees[i-1] for i in range(1, n+1)]

for i in range(1,n):
    max1[i] = max(max1[i-1], max1[i])
for i in range(n-2, -1, -1):
    max2[i] = max(max2[i+1], max2[i])

sussies[0] = max2[0]
sussies[n] = max1[-1]

for i in range(1,n):
    sussies[i] = max(max1[i-1], max2[i])
realsus = [max(0,sussies[tiesmap[i]]) for i in realsus]
print(*realsus)
# Verdict Execution time Memory Grader output
1 Correct 38 ms 18240 KB Output is correct
2 Correct 40 ms 18216 KB Output is correct
3 Correct 34 ms 18204 KB Output is correct
4 Correct 34 ms 18180 KB Output is correct
5 Correct 34 ms 18292 KB Output is correct
6 Correct 34 ms 18220 KB Output is correct
7 Correct 34 ms 18212 KB Output is correct
8 Correct 36 ms 18160 KB Output is correct
9 Correct 42 ms 18356 KB Output is correct
10 Correct 38 ms 18232 KB Output is correct
11 Correct 41 ms 18184 KB Output is correct
12 Correct 34 ms 18180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 18240 KB Output is correct
2 Correct 40 ms 18216 KB Output is correct
3 Correct 34 ms 18204 KB Output is correct
4 Correct 34 ms 18180 KB Output is correct
5 Correct 34 ms 18292 KB Output is correct
6 Correct 34 ms 18220 KB Output is correct
7 Correct 34 ms 18212 KB Output is correct
8 Correct 36 ms 18160 KB Output is correct
9 Correct 42 ms 18356 KB Output is correct
10 Correct 38 ms 18232 KB Output is correct
11 Correct 41 ms 18184 KB Output is correct
12 Correct 34 ms 18180 KB Output is correct
13 Correct 42 ms 18232 KB Output is correct
14 Correct 48 ms 19480 KB Output is correct
15 Correct 66 ms 21744 KB Output is correct
16 Correct 40 ms 18272 KB Output is correct
17 Correct 76 ms 22124 KB Output is correct
18 Correct 65 ms 21456 KB Output is correct
19 Correct 65 ms 21512 KB Output is correct
20 Correct 67 ms 21496 KB Output is correct
21 Correct 63 ms 21416 KB Output is correct
22 Correct 74 ms 21524 KB Output is correct
23 Correct 74 ms 21808 KB Output is correct
24 Correct 65 ms 21588 KB Output is correct
25 Correct 66 ms 22472 KB Output is correct
26 Correct 66 ms 22432 KB Output is correct
27 Correct 85 ms 22184 KB Output is correct
28 Correct 88 ms 22720 KB Output is correct
29 Correct 68 ms 21520 KB Output is correct
30 Correct 69 ms 22364 KB Output is correct
31 Correct 66 ms 22300 KB Output is correct
32 Correct 66 ms 22544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 18240 KB Output is correct
2 Correct 40 ms 18216 KB Output is correct
3 Correct 34 ms 18204 KB Output is correct
4 Correct 34 ms 18180 KB Output is correct
5 Correct 34 ms 18292 KB Output is correct
6 Correct 34 ms 18220 KB Output is correct
7 Correct 34 ms 18212 KB Output is correct
8 Correct 36 ms 18160 KB Output is correct
9 Correct 42 ms 18356 KB Output is correct
10 Correct 38 ms 18232 KB Output is correct
11 Correct 41 ms 18184 KB Output is correct
12 Correct 34 ms 18180 KB Output is correct
13 Correct 42 ms 18232 KB Output is correct
14 Correct 48 ms 19480 KB Output is correct
15 Correct 66 ms 21744 KB Output is correct
16 Correct 40 ms 18272 KB Output is correct
17 Correct 76 ms 22124 KB Output is correct
18 Correct 65 ms 21456 KB Output is correct
19 Correct 65 ms 21512 KB Output is correct
20 Correct 67 ms 21496 KB Output is correct
21 Correct 63 ms 21416 KB Output is correct
22 Correct 74 ms 21524 KB Output is correct
23 Correct 74 ms 21808 KB Output is correct
24 Correct 65 ms 21588 KB Output is correct
25 Correct 66 ms 22472 KB Output is correct
26 Correct 66 ms 22432 KB Output is correct
27 Correct 85 ms 22184 KB Output is correct
28 Correct 88 ms 22720 KB Output is correct
29 Correct 68 ms 21520 KB Output is correct
30 Correct 69 ms 22364 KB Output is correct
31 Correct 66 ms 22300 KB Output is correct
32 Correct 66 ms 22544 KB Output is correct
33 Correct 391 ms 73484 KB Output is correct
34 Correct 389 ms 71952 KB Output is correct
35 Correct 362 ms 70944 KB Output is correct
36 Correct 405 ms 70912 KB Output is correct
37 Correct 362 ms 73580 KB Output is correct
38 Correct 437 ms 72784 KB Output is correct
39 Correct 373 ms 73732 KB Output is correct
40 Correct 366 ms 72252 KB Output is correct
41 Correct 394 ms 71376 KB Output is correct
42 Correct 373 ms 72828 KB Output is correct
43 Correct 364 ms 73520 KB Output is correct
44 Correct 370 ms 71412 KB Output is correct
45 Correct 367 ms 72820 KB Output is correct
46 Correct 341 ms 74136 KB Output is correct
47 Correct 311 ms 68372 KB Output is correct
48 Correct 273 ms 68432 KB Output is correct
49 Correct 379 ms 72024 KB Output is correct
50 Correct 355 ms 72028 KB Output is correct
51 Correct 400 ms 72500 KB Output is correct
52 Correct 355 ms 71900 KB Output is correct
53 Correct 406 ms 71964 KB Output is correct