Task: | Moon landing |
Sender: | esya_rae |
Submission time: | 2024-09-23 17:08:20 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.04 s | details |
#2 | ACCEPTED | 0.04 s | details |
#3 | ACCEPTED | 0.04 s | details |
#4 | ACCEPTED | 0.04 s | details |
#5 | ACCEPTED | 0.04 s | details |
#6 | ACCEPTED | 0.04 s | details |
#7 | ACCEPTED | 0.04 s | details |
#8 | ACCEPTED | 0.04 s | details |
#9 | ACCEPTED | 0.04 s | details |
#10 | ACCEPTED | 0.04 s | details |
#11 | ACCEPTED | 0.04 s | details |
#12 | ACCEPTED | 0.04 s | details |
#13 | ACCEPTED | 0.04 s | details |
#14 | ACCEPTED | 0.04 s | details |
#15 | ACCEPTED | 0.05 s | details |
#16 | ACCEPTED | 0.04 s | details |
#17 | ACCEPTED | 0.04 s | details |
#18 | ACCEPTED | 0.04 s | details |
#19 | ACCEPTED | 0.04 s | details |
#20 | ACCEPTED | 0.04 s | details |
#21 | ACCEPTED | 0.04 s | details |
#22 | ACCEPTED | 0.04 s | details |
#23 | ACCEPTED | 0.04 s | details |
#24 | ACCEPTED | 0.04 s | details |
#25 | ACCEPTED | 0.04 s | details |
#26 | WRONG ANSWER | 0.04 s | details |
#27 | ACCEPTED | 0.04 s | details |
#28 | ACCEPTED | 0.04 s | details |
#29 | ACCEPTED | 0.04 s | details |
#30 | ACCEPTED | 0.08 s | details |
#31 | ACCEPTED | 0.08 s | details |
#32 | ACCEPTED | 0.08 s | details |
#33 | ACCEPTED | 0.08 s | details |
#34 | ACCEPTED | 0.07 s | details |
#35 | ACCEPTED | 0.08 s | details |
#36 | ACCEPTED | 0.04 s | details |
#37 | ACCEPTED | 0.10 s | details |
#38 | WRONG ANSWER | 0.07 s | details |
#39 | ACCEPTED | 0.08 s | details |
#40 | WRONG ANSWER | 0.09 s | details |
#41 | ACCEPTED | 0.10 s | details |
#42 | ACCEPTED | 0.10 s | details |
#43 | WRONG ANSWER | 0.09 s | details |
#44 | ACCEPTED | 0.09 s | details |
#45 | ACCEPTED | 0.10 s | details |
#46 | ACCEPTED | 0.08 s | details |
#47 | ACCEPTED | 0.12 s | details |
#48 | WRONG ANSWER | 0.09 s | details |
#49 | ACCEPTED | 0.10 s | details |
#50 | ACCEPTED | 0.24 s | details |
#51 | ACCEPTED | 0.24 s | details |
#52 | ACCEPTED | 0.24 s | details |
#53 | TIME LIMIT EXCEEDED | -- | details |
#54 | TIME LIMIT EXCEEDED | -- | details |
#55 | TIME LIMIT EXCEEDED | -- | details |
#56 | TIME LIMIT EXCEEDED | -- | details |
#57 | TIME LIMIT EXCEEDED | -- | details |
#58 | TIME LIMIT EXCEEDED | -- | details |
#59 | TIME LIMIT EXCEEDED | -- | details |
#60 | TIME LIMIT EXCEEDED | -- | details |
#61 | TIME LIMIT EXCEEDED | -- | details |
#62 | TIME LIMIT EXCEEDED | -- | details |
#63 | TIME LIMIT EXCEEDED | -- | details |
#64 | TIME LIMIT EXCEEDED | -- | details |
Code
import math n, x = map(int, input().split()) a = list(map(int, input().split())) k = round(n ** 0.5) a_min = [min(a[i * k: min((i + 1) * k, n)]) for i in range((n + k - 1) // k)] a_max = [max(a[i * k: max((i + 1) * k, n)]) for i in range((n + k - 1) // k)] def find(i, j): mmax = -math.inf mmin = math.inf m = i while m <= j and m % k != 0: mmax = max(mmax, a[m]) mmin = min(mmin, a[m]) m += 1 while m <= j - k: mmax = max(mmax, a_max[m // k]) mmin = min(mmin, a_min[m // k]) m += k while m <= j: mmax = max(mmax, a[m]) mmin = min(mmin, a[m]) m += 1 return mmax - mmin maxx = 1 maxx_pos = 0 for i in range(n): for j in range(i + 1, n): if j - i + 1 >= maxx and find(i, j) <= x: maxx = j - i + 1 maxx_pos = i + 1 print(maxx_pos, maxx)
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 1 6 |
correct output |
---|
1 1 |
user output |
---|
0 1 |
Test 2
Verdict: ACCEPTED
input |
---|
2 10 0 2 |
correct output |
---|
1 2 |
user output |
---|
1 2 |
Test 3
Verdict: ACCEPTED
input |
---|
2 4 7 7 |
correct output |
---|
1 2 |
user output |
---|
1 2 |
Test 4
Verdict: ACCEPTED
input |
---|
3 8 5 10 5 |
correct output |
---|
1 3 |
user output |
---|
1 3 |
Test 5
Verdict: ACCEPTED
input |
---|
3 10 3 6 7 |
correct output |
---|
1 3 |
user output |
---|
1 3 |
Test 6
Verdict: ACCEPTED
input |
---|
3 0 6 9 5 |
correct output |
---|
1 1 |
user output |
---|
0 1 |
Test 7
Verdict: ACCEPTED
input |
---|
4 3 8 5 1 10 |
correct output |
---|
1 2 |
user output |
---|
1 2 |
Test 8
Verdict: ACCEPTED
input |
---|
4 9 6 3 8 7 |
correct output |
---|
1 4 |
user output |
---|
1 4 |
Test 9
Verdict: ACCEPTED
input |
---|
4 10 1 9 6 8 |
correct output |
---|
1 4 |
user output |
---|
1 4 |
Test 10
Verdict: ACCEPTED
input |
---|
5 6 6 7 9 6 9 |
correct output |
---|
1 5 |
user output |
---|
1 5 |
Test 11
Verdict: ACCEPTED
input |
---|
5 4 10 7 10 0 1 |
correct output |
---|
1 3 |
user output |
---|
1 3 |
Test 12
Verdict: ACCEPTED
input |
---|
5 4 2 0 10 6 10 |
correct output |
---|
3 3 |
user output |
---|
3 3 |
Test 13
Verdict: ACCEPTED
input |
---|
5 6 0 7 9 3 1 |
correct output |
---|
2 3 |
user output |
---|
2 3 |
Test 14
Verdict: ACCEPTED
input |
---|
5 10 9 6 1 10 9 |
correct output |
---|
1 5 |
user output |
---|
1 5 |
Test 15
Verdict: ACCEPTED
input |
---|
5 2 0 9 9 2 4 |
correct output |
---|
2 2 |
user output |
---|
4 2 |
Test 16
Verdict: ACCEPTED
input |
---|
5 9 10 3 2 9 0 |
correct output |
---|
1 4 |
user output |
---|
2 4 |
Test 17
Verdict: ACCEPTED
input |
---|
5 0 2 8 3 4 10 |
correct output |
---|
1 1 |
user output |
---|
0 1 |
Test 18
Verdict: ACCEPTED
input |
---|
5 9 0 10 2 9 4 |
correct output |
---|
2 4 |
user output |
---|
2 4 |
Test 19
Verdict: ACCEPTED
input |
---|
5 0 4 5 5 5 0 |
correct output |
---|
2 3 |
user output |
---|
2 3 |
Test 20
Verdict: ACCEPTED
input |
---|
10 6 6 7 9 6 9 5 9 4 6 7 |
correct output |
---|
1 10 |
user output |
---|
1 10 |
Test 21
Verdict: ACCEPTED
input |
---|
10 4 10 7 10 0 1 3 10 1 2 1 |
correct output |
---|
1 3 |
user output |
---|
8 3 |
Test 22
Verdict: ACCEPTED
input |
---|
10 4 2 0 10 6 10 4 5 4 3 3 |
correct output |
---|
6 5 |
user output |
---|
6 5 |
Test 23
Verdict: ACCEPTED
input |
---|
10 6 0 7 9 3 1 5 6 9 4 9 |
correct output |
---|
6 5 |
user output |
---|
6 5 |
Test 24
Verdict: ACCEPTED
input |
---|
10 10 9 6 1 10 9 7 6 7 6 2 |
correct output |
---|
1 10 |
user output |
---|
1 10 |
Test 25
Verdict: ACCEPTED
input |
---|
10 2 0 9 9 2 4 10 10 5 0 6 |
correct output |
---|
2 2 |
user output |
---|
6 2 |
Test 26
Verdict: WRONG ANSWER
input |
---|
10 9 10 3 2 9 0 0 4 1 10 6 |
correct output |
---|
2 7 |
user output |
---|
2 5 |
Test 27
Verdict: ACCEPTED
input |
---|
10 0 2 8 3 4 10 7 5 10 3 5 |
correct output |
---|
1 1 |
user output |
---|
0 1 |
Test 28
Verdict: ACCEPTED
input |
---|
10 9 0 10 2 9 4 5 8 2 4 0 |
correct output |
---|
2 8 |
user output |
---|
3 8 |
Test 29
Verdict: ACCEPTED
input |
---|
10 0 4 5 5 5 0 1 3 1 0 2 |
correct output |
---|
2 3 |
user output |
---|
2 3 |
Test 30
Verdict: ACCEPTED
input |
---|
100 589284011 636562059 767928733 906523440 ... |
correct output |
---|
1 12 |
user output |
---|
1 12 |
Test 31
Verdict: ACCEPTED
input |
---|
100 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
2 10 |
Test 32
Verdict: ACCEPTED
input |
---|
100 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
60 11 |
Test 33
Verdict: ACCEPTED
input |
---|
100 591414746 75940262 760367934 901888416 3... |
correct output |
---|
34 14 |
user output |
---|
34 14 |
Test 34
Verdict: ACCEPTED
input |
---|
100 967034923 587586157 185430193 918715994 ... |
correct output |
---|
37 64 |
user output |
---|
37 64 |
Test 35
Verdict: ACCEPTED
input |
---|
100 238363352 59249203 934941691 892631471 2... |
correct output |
---|
34 5 |
user output |
---|
34 5 |
Test 36
Verdict: ACCEPTED
input |
---|
100 958701282 356460600 224848373 881788058 ... |
correct output |
---|
1 100 |
user output |
---|
1 100 |
Test 37
Verdict: ACCEPTED
input |
---|
100 81935403 244103473 837431430 342493821 ... |
correct output |
---|
21 3 |
user output |
---|
96 3 |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 937837680 11934037 257096282 933290529 4... |
correct output |
---|
29 54 |
user output |
---|
29 26 |
Test 39
Verdict: ACCEPTED
input |
---|
100 11139167 391337047 538883743 535937149 ... |
correct output |
---|
2 3 |
user output |
---|
2 3 |
Test 40
Verdict: WRONG ANSWER
input |
---|
200 589284011 636562059 767928733 906523440 ... |
correct output |
---|
99 15 |
user output |
---|
100 14 |
Test 41
Verdict: ACCEPTED
input |
---|
200 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
2 10 |
Test 42
Verdict: ACCEPTED
input |
---|
200 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
60 11 |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 591414746 75940262 760367934 901888416 3... |
correct output |
---|
104 24 |
user output |
---|
104 23 |
Test 44
Verdict: ACCEPTED
input |
---|
200 967034923 587586157 185430193 918715994 ... |
correct output |
---|
37 111 |
user output |
---|
37 111 |
Test 45
Verdict: ACCEPTED
input |
---|
200 238363352 59249203 934941691 892631471 2... |
correct output |
---|
34 5 |
user output |
---|
34 5 |
Test 46
Verdict: ACCEPTED
input |
---|
200 958701282 356460600 224848373 881788058 ... |
correct output |
---|
1 138 |
user output |
---|
1 138 |
Test 47
Verdict: ACCEPTED
input |
---|
200 81935403 244103473 837431430 342493821 ... |
correct output |
---|
21 3 |
user output |
---|
198 3 |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 937837680 11934037 257096282 933290529 4... |
correct output |
---|
84 66 |
user output |
---|
143 41 |
Test 49
Verdict: ACCEPTED
input |
---|
200 11139167 391337047 538883743 535937149 ... |
correct output |
---|
2 3 |
user output |
---|
2 3 |
Test 50
Verdict: ACCEPTED
input |
---|
1000 589284011 636562059 767928733 906523440 ... |
correct output |
---|
99 15 |
user output |
---|
99 15 |
Test 51
Verdict: ACCEPTED
input |
---|
1000 447773961 773442531 122815 137572578 324... |
correct output |
---|
2 10 |
user output |
---|
712 10 |
Test 52
Verdict: ACCEPTED
input |
---|
1000 468145962 198730371 27838075 590195589 4... |
correct output |
---|
60 11 |
user output |
---|
744 11 |
Test 53
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000 591414746 75940262 760367934 901888416 3... |
correct output |
---|
104 24 |
user output |
---|
(empty) |
Test 54
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000 967034923 587586157 185430193 918715994 ... |
correct output |
---|
3660 279 |
user output |
---|
(empty) |
Test 55
Verdict: TIME LIMIT EXCEEDED
input |
---|
10000 238363352 59249203 934941691 892631471 2... |
correct output |
---|
325 9 |
user output |
---|
(empty) |
Test 56
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 958701282 356460600 224848373 881788058 ... |
correct output |
---|
66493 302 |
user output |
---|
(empty) |
Test 57
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 81935403 244103473 837431430 342493821 ... |
correct output |
---|
28066 7 |
user output |
---|
(empty) |
Test 58
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 937837680 11934037 257096282 933290529 4... |
correct output |
---|
91851 177 |
user output |
---|
(empty) |
Test 59
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 11139167 391337047 538883743 535937149 ... |
correct output |
---|
84138 4 |
user output |
---|
(empty) |
Test 60
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 239756970 350744379 561742366 59793553 5... |
correct output |
---|
94284 12 |
user output |
---|
(empty) |
Test 61
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 316394139 195182396 569713187 906489185 ... |
correct output |
---|
12844 13 |
user output |
---|
(empty) |
Test 62
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 698334026 81615940 542726430 464528081 9... |
correct output |
---|
28811 40 |
user output |
---|
(empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 104725911 462211739 817385661 443179352 ... |
correct output |
---|
46788 9 |
user output |
---|
(empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 20 13 15 11 10 13 16 17 18 15 18 ... |
correct output |
---|
1 100000 |
user output |
---|
(empty) |