Task: | Targeted advertising |
Sender: | louaha1 |
Submission time: | 2024-09-23 17:38:42 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.02 s | details |
#2 | WRONG ANSWER | 0.02 s | details |
#3 | WRONG ANSWER | 0.02 s | details |
#4 | WRONG ANSWER | 0.02 s | details |
#5 | WRONG ANSWER | 0.02 s | details |
#6 | WRONG ANSWER | 0.02 s | details |
#7 | WRONG ANSWER | 0.02 s | details |
#8 | WRONG ANSWER | 0.02 s | details |
#9 | WRONG ANSWER | 0.02 s | details |
#10 | WRONG ANSWER | 0.02 s | details |
#11 | WRONG ANSWER | 0.02 s | details |
#12 | WRONG ANSWER | 0.02 s | details |
#13 | WRONG ANSWER | 0.02 s | details |
#14 | WRONG ANSWER | 0.02 s | details |
#15 | WRONG ANSWER | 0.02 s | details |
#16 | WRONG ANSWER | 0.02 s | details |
#17 | WRONG ANSWER | 0.02 s | details |
#18 | WRONG ANSWER | 0.02 s | details |
#19 | WRONG ANSWER | 0.02 s | details |
#20 | WRONG ANSWER | 0.02 s | details |
#21 | WRONG ANSWER | 0.02 s | details |
#22 | WRONG ANSWER | 0.02 s | details |
#23 | WRONG ANSWER | 0.02 s | details |
#24 | WRONG ANSWER | 0.02 s | details |
#25 | WRONG ANSWER | 0.02 s | details |
#26 | WRONG ANSWER | 0.02 s | details |
#27 | WRONG ANSWER | 0.02 s | details |
#28 | WRONG ANSWER | 0.02 s | details |
#29 | WRONG ANSWER | 0.02 s | details |
#30 | WRONG ANSWER | 0.02 s | details |
#31 | WRONG ANSWER | 0.02 s | details |
#32 | WRONG ANSWER | 0.02 s | details |
#33 | WRONG ANSWER | 0.02 s | details |
#34 | WRONG ANSWER | 0.02 s | details |
#35 | WRONG ANSWER | 0.02 s | details |
#36 | WRONG ANSWER | 0.02 s | details |
#37 | WRONG ANSWER | 0.02 s | details |
#38 | WRONG ANSWER | 0.02 s | details |
#39 | WRONG ANSWER | 0.02 s | details |
#40 | WRONG ANSWER | 0.02 s | details |
#41 | WRONG ANSWER | 0.02 s | details |
#42 | WRONG ANSWER | 0.02 s | details |
#43 | WRONG ANSWER | 0.02 s | details |
#44 | WRONG ANSWER | 0.02 s | details |
#45 | WRONG ANSWER | 0.02 s | details |
#46 | WRONG ANSWER | 0.02 s | details |
#47 | WRONG ANSWER | 0.02 s | details |
#48 | WRONG ANSWER | 0.02 s | details |
#49 | WRONG ANSWER | 0.02 s | details |
#50 | WRONG ANSWER | 0.02 s | details |
#51 | WRONG ANSWER | 0.02 s | details |
#52 | WRONG ANSWER | 0.02 s | details |
#53 | WRONG ANSWER | 0.02 s | details |
#54 | WRONG ANSWER | 0.02 s | details |
#55 | WRONG ANSWER | 0.02 s | details |
#56 | WRONG ANSWER | 0.02 s | details |
#57 | WRONG ANSWER | 0.02 s | details |
#58 | WRONG ANSWER | 0.02 s | details |
#59 | WRONG ANSWER | 0.02 s | details |
#60 | WRONG ANSWER | 0.02 s | details |
#61 | WRONG ANSWER | 0.02 s | details |
#62 | WRONG ANSWER | 0.02 s | details |
#63 | WRONG ANSWER | 0.02 s | details |
#64 | WRONG ANSWER | 0.02 s | details |
#65 | WRONG ANSWER | 0.02 s | details |
#66 | WRONG ANSWER | 0.02 s | details |
#67 | WRONG ANSWER | 0.02 s | details |
#68 | WRONG ANSWER | 0.02 s | details |
#69 | WRONG ANSWER | 0.02 s | details |
#70 | WRONG ANSWER | 0.02 s | details |
Code
from collections import defaultdict from bisect import bisect_left, bisect_right def solve(): import sys input = sys.stdin.read data = input().splitlines() n, k, q = map(int, data[0].split()) a = list(map(int, data[1].split())) # Dictionary to store positions of each interest interest_positions = defaultdict(list) # Populate the dictionary for i in range(n): interest_positions[a[i]].append(i + 1) results = [] # Process queries for i in range(2, 2 + q): l, r, x = map(int, data[i].split()) positions = interest_positions[x] # Binary search for the range [l, r] left = bisect_left(positions, l) right = bisect_right(positions, r) results.append(right - left) # Output all results sys.stdout.write("\n".join(map(str, results)) + "\n")
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1 1 1 1 1 1 1 |
correct output |
---|
1 |
user output |
---|
(empty) |
Test 2
Verdict: WRONG ANSWER
input |
---|
1 1 2 1 1 1 1 1 1 1 |
correct output |
---|
1 1 |
user output |
---|
(empty) |
Test 3
Verdict: WRONG ANSWER
input |
---|
2 1 2 1 1 2 2 1 1 2 1 |
correct output |
---|
1 2 |
user output |
---|
(empty) |
Test 4
Verdict: WRONG ANSWER
input |
---|
2 2 5 2 1 1 1 2 1 1 2 1 2 2 ... |
correct output |
---|
1 1 1 1 1 |
user output |
---|
(empty) |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 2 4 1 1 1 1 3 1 2 3 2 2 2 2 ... |
correct output |
---|
3 0 0 0 |
user output |
---|
(empty) |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 3 8 2 3 1 2 3 2 1 2 2 2 3 1 ... |
correct output |
---|
0 1 1 1 1 ... |
user output |
---|
(empty) |
Test 7
Verdict: WRONG ANSWER
input |
---|
4 2 9 2 2 1 2 2 2 2 2 4 1 2 3 1 ... |
correct output |
---|
1 1 1 1 2 ... |
user output |
---|
(empty) |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 3 11 3 3 2 2 3 3 2 2 4 1 3 3 3 ... |
correct output |
---|
1 0 0 1 1 ... |
user output |
---|
(empty) |
Test 9
Verdict: WRONG ANSWER
input |
---|
4 4 8 4 1 4 2 3 4 2 2 2 1 1 4 2 ... |
correct output |
---|
1 1 1 1 1 ... |
user output |
---|
(empty) |
Test 10
Verdict: WRONG ANSWER
input |
---|
5 3 11 3 3 2 3 2 3 5 2 2 4 2 2 5 1 ... |
correct output |
---|
2 1 0 2 1 ... |
user output |
---|
(empty) |
Test 11
Verdict: WRONG ANSWER
input |
---|
5 5 9 4 5 1 1 2 1 5 2 1 2 1 2 2 4 ... |
correct output |
---|
1 0 0 0 1 ... |
user output |
---|
(empty) |
Test 12
Verdict: WRONG ANSWER
input |
---|
5 1 9 1 1 1 1 1 3 3 1 1 2 1 4 4 1 ... |
correct output |
---|
1 2 1 2 1 ... |
user output |
---|
(empty) |
Test 13
Verdict: WRONG ANSWER
input |
---|
5 1 11 1 1 1 1 1 3 5 1 1 5 1 1 2 1 ... |
correct output |
---|
3 5 2 1 4 ... |
user output |
---|
(empty) |
Test 14
Verdict: WRONG ANSWER
input |
---|
5 5 15 3 1 5 5 4 4 4 3 1 2 5 1 2 4 ... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 15
Verdict: WRONG ANSWER
input |
---|
5 1 7 1 1 1 1 1 3 5 1 2 4 1 2 3 1 ... |
correct output |
---|
3 3 2 4 5 ... |
user output |
---|
(empty) |
Test 16
Verdict: WRONG ANSWER
input |
---|
5 5 14 2 2 5 1 1 1 2 5 1 3 3 3 4 3 ... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 17
Verdict: WRONG ANSWER
input |
---|
5 2 5 2 1 1 2 2 3 5 1 2 3 2 1 1 1 ... |
correct output |
---|
1 0 0 1 1 |
user output |
---|
(empty) |
Test 18
Verdict: WRONG ANSWER
input |
---|
5 1 14 1 1 1 1 1 2 5 1 1 4 1 3 4 1 ... |
correct output |
---|
4 4 2 3 3 ... |
user output |
---|
(empty) |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 2 5 2 1 1 1 1 1 2 1 2 5 1 1 2 1 ... |
correct output |
---|
1 4 1 1 2 |
user output |
---|
(empty) |
Test 20
Verdict: WRONG ANSWER
input |
---|
10 6 21 5 6 4 6 4 6 3 4 4 3 3 5 6 1 10 2 4 5 5 ... |
correct output |
---|
1 0 0 1 2 ... |
user output |
---|
(empty) |
Test 21
Verdict: WRONG ANSWER
input |
---|
10 10 18 8 10 1 2 4 10 2 3 1 4 2 4 4 4 7 10 6 9 5 ... |
correct output |
---|
0 1 0 0 0 ... |
user output |
---|
(empty) |
Test 22
Verdict: WRONG ANSWER
input |
---|
10 2 19 1 2 2 2 1 1 1 1 1 1 3 7 2 2 3 1 3 7 2 ... |
correct output |
---|
2 0 2 0 3 ... |
user output |
---|
(empty) |
Test 23
Verdict: WRONG ANSWER
input |
---|
10 1 21 1 1 1 1 1 1 1 1 1 1 1 2 1 1 3 1 5 7 1 ... |
correct output |
---|
2 3 3 4 5 ... |
user output |
---|
(empty) |
Test 24
Verdict: WRONG ANSWER
input |
---|
10 10 30 6 2 10 9 8 7 7 6 3 2 3 10 1 3 7 10 5 7 8 ... |
correct output |
---|
0 1 1 1 0 ... |
user output |
---|
(empty) |
Test 25
Verdict: WRONG ANSWER
input |
---|
10 1 14 1 1 1 1 1 1 1 1 1 1 4 8 1 3 5 1 2 9 1 ... |
correct output |
---|
5 3 8 2 3 ... |
user output |
---|
(empty) |
Test 26
Verdict: WRONG ANSWER
input |
---|
10 10 28 4 3 9 1 1 4 2 10 6 1 6 7 5 4 6 5 7 9 5 ... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 3 11 3 1 2 3 3 2 3 1 2 1 1 6 1 3 5 1 5 6 3 ... |
correct output |
---|
1 0 1 0 0 ... |
user output |
---|
(empty) |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 1 28 1 1 1 1 1 1 1 1 1 1 5 8 1 5 6 1 5 10 1 ... |
correct output |
---|
4 2 6 5 4 ... |
user output |
---|
(empty) |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 4 10 3 2 2 1 1 2 1 1 1 4 2 5 1 1 2 2 4 5 1 ... |
correct output |
---|
2 1 2 1 2 ... |
user output |
---|
(empty) |
Test 30
Verdict: WRONG ANSWER
input |
---|
100 60 210 43 51 37 52 33 51 26 38 39 24 ... |
correct output |
---|
0 1 0 1 0 ... |
user output |
---|
(empty) |
Test 31
Verdict: WRONG ANSWER
input |
---|
100 100 183 73 94 1 13 31 100 15 24 10 40 ... |
correct output |
---|
0 1 1 0 0 ... |
user output |
---|
(empty) |
Test 32
Verdict: WRONG ANSWER
input |
---|
100 19 187 1 18 11 19 9 10 8 7 7 3 4 14 1... |
correct output |
---|
5 0 0 3 4 ... |
user output |
---|
(empty) |
Test 33
Verdict: WRONG ANSWER
input |
---|
100 8 210 6 7 3 1 5 5 8 4 8 1 2 1 2 2 1 ... |
correct output |
---|
0 9 0 3 4 ... |
user output |
---|
(empty) |
Test 34
Verdict: WRONG ANSWER
input |
---|
100 91 294 50 16 89 78 66 56 64 55 20 13 ... |
correct output |
---|
1 0 0 0 0 ... |
user output |
---|
(empty) |
Test 35
Verdict: WRONG ANSWER
input |
---|
100 6 144 6 5 2 3 6 6 3 1 4 3 5 3 4 3 2 ... |
correct output |
---|
7 15 10 15 5 ... |
user output |
---|
(empty) |
Test 36
Verdict: WRONG ANSWER
input |
---|
100 95 279 32 20 79 7 4 36 11 94 57 10 51... |
correct output |
---|
0 2 1 1 0 ... |
user output |
---|
(empty) |
Test 37
Verdict: WRONG ANSWER
input |
---|
100 23 115 18 8 11 23 17 11 23 8 13 7 12 ... |
correct output |
---|
1 0 0 4 0 ... |
user output |
---|
(empty) |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 2 275 2 1 2 1 2 2 1 1 1 2 1 2 1 1 2 ... |
correct output |
---|
26 30 13 11 16 ... |
user output |
---|
(empty) |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 37 102 19 19 19 1 5 12 6 1 9 33 16 6 ... |
correct output |
---|
1 1 3 2 1 ... |
user output |
---|
(empty) |
Test 40
Verdict: WRONG ANSWER
input |
---|
200 119 420 86 101 72 103 65 101 51 75 77 ... |
correct output |
---|
1 0 0 0 0 ... |
user output |
---|
(empty) |
Test 41
Verdict: WRONG ANSWER
input |
---|
200 200 367 145 187 1 26 61 200 30 48 19 8... |
correct output |
---|
0 0 2 0 0 ... |
user output |
---|
(empty) |
Test 42
Verdict: WRONG ANSWER
input |
---|
200 38 374 1 36 21 37 17 19 16 13 13 6 8 ... |
correct output |
---|
1 1 3 3 0 ... |
user output |
---|
(empty) |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 15 420 11 13 5 2 8 9 14 7 14 1 2 1 4 ... |
correct output |
---|
6 0 11 2 3 ... |
user output |
---|
(empty) |
Test 44
Verdict: WRONG ANSWER
input |
---|
200 181 587 100 32 177 155 130 111 127 109... |
correct output |
---|
0 1 2 1 0 ... |
user output |
---|
(empty) |
Test 45
Verdict: WRONG ANSWER
input |
---|
200 12 289 11 10 3 5 12 12 6 2 8 5 10 5 7... |
correct output |
---|
2 13 0 3 6 ... |
user output |
---|
(empty) |
Test 46
Verdict: WRONG ANSWER
input |
---|
200 190 558 64 40 157 13 8 71 21 188 114 1... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 47
Verdict: WRONG ANSWER
input |
---|
200 46 230 36 15 21 45 34 21 45 15 25 13 ... |
correct output |
---|
0 0 0 4 1 ... |
user output |
---|
(empty) |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 3 550 3 1 3 2 2 3 1 2 1 2 2 3 2 2 2 ... |
correct output |
---|
38 59 26 36 10 ... |
user output |
---|
(empty) |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 73 204 37 37 37 1 10 24 11 1 16 65 31... |
correct output |
---|
2 3 0 4 0 ... |
user output |
---|
(empty) |
Test 50
Verdict: WRONG ANSWER
input |
---|
1000 593 2098 425 501 358 509 324 503 252 37... |
correct output |
---|
1 0 0 0 4 ... |
user output |
---|
(empty) |
Test 51
Verdict: WRONG ANSWER
input |
---|
1000 998 1834 719 931 1 128 302 998 147 236 ... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 52
Verdict: WRONG ANSWER
input |
---|
1000 186 1872 5 174 103 177 81 91 79 60 62 2... |
correct output |
---|
0 0 1 3 0 ... |
user output |
---|
(empty) |
Test 53
Verdict: WRONG ANSWER
input |
---|
1000 71 2102 51 60 21 9 37 41 64 32 64 2 9 ... |
correct output |
---|
1 1 3 15 4 ... |
user output |
---|
(empty) |
Test 54
Verdict: WRONG ANSWER
input |
---|
1000 901 2935 494 156 877 771 645 549 629 53... |
correct output |
---|
0 0 1 1 0 ... |
user output |
---|
(empty) |
Test 55
Verdict: WRONG ANSWER
input |
---|
1000 56 1444 49 47 12 21 52 55 28 6 35 23 4... |
correct output |
---|
11 11 1 0 2 ... |
user output |
---|
(empty) |
Test 56
Verdict: WRONG ANSWER
input |
---|
1000 948 2786 315 199 779 61 40 351 103 934 ... |
correct output |
---|
1 0 1 0 0 ... |
user output |
---|
(empty) |
Test 57
Verdict: WRONG ANSWER
input |
---|
1000 228 1152 178 73 100 224 165 104 223 71 ... |
correct output |
---|
1 1 2 3 0 ... |
user output |
---|
(empty) |
Test 58
Verdict: WRONG ANSWER
input |
---|
1000 12 2747 12 3 11 5 7 10 3 6 1 8 6 10 5 ... |
correct output |
---|
0 25 15 7 47 ... |
user output |
---|
(empty) |
Test 59
Verdict: WRONG ANSWER
input |
---|
1000 365 1020 184 183 181 3 49 116 52 5 80 3... |
correct output |
---|
1 0 0 1 0 ... |
user output |
---|
(empty) |
Test 60
Verdict: WRONG ANSWER
input |
---|
100000 59286 100000 42402 50054 35736 50865 32305 ... |
correct output |
---|
1 0 3 1 1 ... |
user output |
---|
(empty) |
Test 61
Verdict: WRONG ANSWER
input |
---|
100000 99721 100000 71833 92998 12 12777 30150 996... |
correct output |
---|
1 0 0 0 0 ... |
user output |
---|
(empty) |
Test 62
Verdict: WRONG ANSWER
input |
---|
100000 18509 100000 480 17242 10174 17542 8058 897... |
correct output |
---|
0 2 1 1 1 ... |
user output |
---|
(empty) |
Test 63
Verdict: WRONG ANSWER
input |
---|
100000 7073 100000 5009 5941 2058 859 3614 4027 6... |
correct output |
---|
6 9 3 2 0 ... |
user output |
---|
(empty) |
Test 64
Verdict: WRONG ANSWER
input |
---|
100000 90064 100000 49287 15554 87606 77063 64381 ... |
correct output |
---|
1 2 0 0 0 ... |
user output |
---|
(empty) |
Test 65
Verdict: WRONG ANSWER
input |
---|
100000 5519 100000 4806 4589 1141 2008 5070 5406 ... |
correct output |
---|
10 1 9 14 0 ... |
user output |
---|
(empty) |
Test 66
Verdict: WRONG ANSWER
input |
---|
100000 94750 100000 31456 19842 77813 6089 3951 35... |
correct output |
---|
0 1 0 1 0 ... |
user output |
---|
(empty) |
Test 67
Verdict: WRONG ANSWER
input |
---|
100000 22735 100000 17732 7252 9968 22240 16449 10... |
correct output |
---|
0 4 0 1 1 ... |
user output |
---|
(empty) |
Test 68
Verdict: WRONG ANSWER
input |
---|
100000 1112 100000 1078 267 967 420 591 908 259 4... |
correct output |
---|
7 13 73 12 23 ... |
user output |
---|
(empty) |
Test 69
Verdict: WRONG ANSWER
input |
---|
100000 36447 100000 18292 18192 18070 275 4878 115... |
correct output |
---|
0 1 1 2 2 ... |
user output |
---|
(empty) |
Test 70
Verdict: WRONG ANSWER
input |
---|
100000 100000 100000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
correct output |
---|
100000 100000 100000 100000 100000 ... |
user output |
---|
(empty) |