Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'While performing complex market analysis William encountered the following problem: For a given array a of size n and a natural number e , calculate the number of pairs of natural numbers (i, k) which satisfy the following conditions: A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10 ,000 ). Description of the test cases follows. The first line of each test case contains two integers n and e (1 <= e <= n <= 2 cdot 10^5) , the number of items in the array and number e , respectively. The second line contains n integers a_1, a_2, ... , a_n (1 <= a_i <= 10^6) , the contents of the array. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case output the answer in the following format: Output one line containing the number of pairs of numbers (i, k) which satisfy the conditions. In the first example test case two pairs satisfy the conditions: In the second example test case there are no pairs that satisfy the conditions. In the third example test case four pairs satisfy the conditions: In the fourth example test case there are no pairs that satisfy the conditions. In the fifth example test case five pairs satisfy the conditions: In the sixth example test case there are no pairs that satisfy the conditions. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
137290043 |
akwa_blue |
C |
Nov. 29, 2021, 2:54 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137287887 |
yueyingxiao |
C |
Nov. 29, 2021, 1:37 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
1433600 |
|
1400 |
137272225 |
123ampagp |
C |
Nov. 28, 2021, 6:03 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
1740800 |
|
1400 |
137279047 |
anutom20 |
C |
Nov. 28, 2021, 8:05 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
1740800 |
|
1400 |
137265023 |
Riblji_Keksic |
C |
Nov. 28, 2021, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
1843200 |
|
1400 |
137288940 |
Mega_Pirate |
C |
Nov. 29, 2021, 2:18 a.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
2560000 |
|
1400 |
137276398 |
ProAbdo |
C |
Nov. 28, 2021, 7:08 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
2662400 |
|
1400 |
137265100 |
sunil1906 |
C |
Nov. 28, 2021, 4:55 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
4198400 |
|
1400 |
137278041 |
L.Morningstar |
C |
Nov. 28, 2021, 7:43 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
4300800 |
|
1400 |
137269374 |
Aditya_871 |
C |
Nov. 28, 2021, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
27 |
62 |
4812800 |
|
1400 |
137291283 |
aj4941 |
C |
Nov. 29, 2021, 3:31 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
61 |
2662400 |
|
1400 |
137273514 |
Ujjwalkool |
C |
Nov. 28, 2021, 6:21 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137256347 |
Ashish_Coder6 |
C |
Nov. 28, 2021, 4:14 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137293042 |
Kanheyalal |
C |
Nov. 29, 2021, 4:22 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137292492 |
tanvir03 |
C |
Nov. 29, 2021, 4:06 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137291544 |
Mongraal |
C |
Nov. 29, 2021, 3:40 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137270685 |
sahilraj2903 |
C |
Nov. 28, 2021, 5:45 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
921600 |
|
1400 |
137262450 |
beautiful2806 |
C |
Nov. 28, 2021, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
1126400 |
|
1400 |
137287440 |
huykhanh |
C |
Nov. 29, 2021, 1:18 a.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
1126400 |
|
1400 |
137274814 |
conqueror_of_colin_galen |
C |
Nov. 28, 2021, 6:40 p.m. |
OK |
GNU C++17 |
TESTS |
27 |
62 |
1740800 |
|
1400 |
137264140 |
CyberEcho |
C |
Nov. 28, 2021, 4:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
921600 |
|
1400 |
137256464 |
yajusharma12 |
C |
Nov. 28, 2021, 4:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
1740800 |
|
1400 |
137265828 |
Van_Hoang |
C |
Nov. 28, 2021, 4:58 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
1740800 |
|
1400 |
137257244 |
pr_iy_an_sh_ut_iw_ar_i |
C |
Nov. 28, 2021, 4:18 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
1740800 |
|
1400 |
137259075 |
vk1cd314 |
C |
Nov. 28, 2021, 4:26 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2048000 |
|
1400 |
137287162 |
prottoyfuad |
C |
Nov. 29, 2021, 1:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2560000 |
|
1400 |
137272146 |
chika10 |
C |
Nov. 28, 2021, 6:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2560000 |
|
1400 |
137310353 |
no_words_to_sky |
C |
Nov. 29, 2021, 5:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2560000 |
|
1400 |
137310197 |
no_words_to_sky |
C |
Nov. 29, 2021, 5:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2560000 |
|
1400 |
137309758 |
no_words_to_sky |
C |
Nov. 29, 2021, 5 a.m. |
OK |
GNU C++17 (64) |
TESTS |
27 |
46 |
2560000 |
|
1400 |
137278307 |
gaserashraf |
C |
Nov. 28, 2021, 7:48 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
921600 |
|
1400 |
137257732 |
Lord_David |
C |
Nov. 28, 2021, 4:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
921600 |
|
1400 |
137291121 |
Turkhuuu |
C |
Nov. 29, 2021, 3:26 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
921600 |
|
1400 |
137271038 |
nazmuShakib |
C |
Nov. 28, 2021, 5:48 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
921600 |
|
1400 |
137287053 |
mdstoy |
C |
Nov. 29, 2021, 1 a.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1024000 |
|
1400 |
137257186 |
yashshingade28 |
C |
Nov. 28, 2021, 4:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1740800 |
|
1400 |
137261715 |
Epinephrinerush |
C |
Nov. 28, 2021, 4:39 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1740800 |
|
1400 |
137264221 |
Amrharb |
C |
Nov. 28, 2021, 4:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1843200 |
|
1400 |
137259444 |
sans |
C |
Nov. 28, 2021, 4:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1843200 |
|
1400 |
137265893 |
jtrh |
C |
Nov. 28, 2021, 4:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
27 |
46 |
1843200 |
|
1400 |
137270943 |
SaberXpro |
C |
Nov. 28, 2021, 5:47 p.m. |
OK |
Java 11 |
TESTS |
27 |
202 |
0 |
|
1400 |
137312738 |
the_unseen |
C |
Nov. 29, 2021, 5:53 a.m. |
OK |
Java 11 |
TESTS |
27 |
217 |
0 |
|
1400 |
137252627 |
long2142453426 |
C |
Nov. 28, 2021, 4 p.m. |
OK |
Java 11 |
TESTS |
27 |
217 |
0 |
|
1400 |
137276451 |
decoder_1671 |
C |
Nov. 28, 2021, 7:09 p.m. |
OK |
Java 11 |
TESTS |
27 |
233 |
0 |
|
1400 |
137269352 |
Nicolas125841 |
C |
Nov. 28, 2021, 5:34 p.m. |
OK |
Java 11 |
TESTS |
27 |
248 |
0 |
|
1400 |
137258272 |
Lucifer_The_Immortal |
C |
Nov. 28, 2021, 4:23 p.m. |
OK |
Java 11 |
TESTS |
27 |
264 |
10752000 |
|
1400 |
137277900 |
anubhav44044 |
C |
Nov. 28, 2021, 7:40 p.m. |
OK |
Java 11 |
TESTS |
27 |
265 |
307200 |
|
1400 |
137255203 |
mrRobot |
C |
Nov. 28, 2021, 4:09 p.m. |
OK |
Java 11 |
TESTS |
27 |
280 |
15052800 |
|
1400 |
137283751 |
DedsecKnight |
C |
Nov. 28, 2021, 10:23 p.m. |
OK |
Java 11 |
TESTS |
27 |
280 |
16588800 |
|
1400 |
137269999 |
PetrNguyen |
C |
Nov. 28, 2021, 5:38 p.m. |
OK |
Java 11 |
TESTS |
27 |
280 |
23040000 |
|
1400 |
137290008 |
golions |
C |
Nov. 29, 2021, 2:52 a.m. |
OK |
Java 8 |
TESTS |
27 |
140 |
2867200 |
|
1400 |
137292779 |
huhansan |
C |
Nov. 29, 2021, 4:14 a.m. |
OK |
Java 8 |
TESTS |
27 |
155 |
5632000 |
|
1400 |
137261821 |
invincible777 |
C |
Nov. 28, 2021, 4:39 p.m. |
OK |
Java 8 |
TESTS |
27 |
170 |
4403200 |
|
1400 |
137277412 |
omar_mohammed |
C |
Nov. 28, 2021, 7:30 p.m. |
OK |
Java 8 |
TESTS |
27 |
171 |
8192000 |
|
1400 |
137275894 |
Adi_7861 |
C |
Nov. 28, 2021, 6:58 p.m. |
OK |
Java 8 |
TESTS |
27 |
171 |
12697600 |
|
1400 |
137269069 |
vivek1401 |
C |
Nov. 28, 2021, 5:32 p.m. |
OK |
Java 8 |
TESTS |
27 |
187 |
7270400 |
|
1400 |
137277129 |
pribic |
C |
Nov. 28, 2021, 7:23 p.m. |
OK |
Java 8 |
TESTS |
27 |
218 |
3276800 |
|
1400 |
137258211 |
idiotThinking |
C |
Nov. 28, 2021, 4:22 p.m. |
OK |
Java 8 |
TESTS |
27 |
218 |
9113600 |
|
1400 |
137269449 |
NussairHroub |
C |
Nov. 28, 2021, 5:35 p.m. |
OK |
Java 8 |
TESTS |
27 |
234 |
3174400 |
|
1400 |
137277671 |
shinghalrishabh |
C |
Nov. 28, 2021, 7:35 p.m. |
OK |
Java 8 |
TESTS |
27 |
249 |
14848000 |
|
1400 |
137261465 |
benibela |
C |
Nov. 28, 2021, 4:37 p.m. |
OK |
Kotlin 1.4 |
TESTS |
27 |
265 |
16179200 |
|
1400 |
137255693 |
catcatcute |
C |
Nov. 28, 2021, 4:12 p.m. |
OK |
Kotlin 1.5 |
TESTS |
27 |
608 |
21196800 |
|
1400 |
137259824 |
psn2706 |
C |
Nov. 28, 2021, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
27 |
171 |
6860800 |
|
1400 |
137258139 |
charleswang2001 |
C |
Nov. 28, 2021, 4:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
27 |
187 |
10649600 |
|
1400 |
137254601 |
miniL |
C |
Nov. 28, 2021, 4:07 p.m. |
OK |
MS C++ 2017 |
TESTS |
27 |
202 |
3379200 |
|
1400 |
137255458 |
Tangerine |
C |
Nov. 28, 2021, 4:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
27 |
217 |
12800000 |
|
1400 |
137260159 |
NorbertG |
C |
Nov. 28, 2021, 4:31 p.m. |
OK |
.NET Core C# |
TESTS |
27 |
187 |
25600000 |
|
1400 |
137289462 |
X-33 |
C |
Nov. 29, 2021, 2:36 a.m. |
OK |
.NET Core C# |
TESTS |
27 |
202 |
24371200 |
|
1400 |
137282440 |
turch |
C |
Nov. 28, 2021, 9:36 p.m. |
OK |
Node.js |
TESTS |
27 |
1622 |
28364800 |
|
1400 |
137274166 |
dotdot11 |
C |
Nov. 28, 2021, 6:30 p.m. |
OK |
Node.js |
TESTS |
27 |
1653 |
28364800 |
|
1400 |
137270397 |
OLOGY |
C |
Nov. 28, 2021, 5:42 p.m. |
OK |
PyPy 2 |
TESTS |
27 |
358 |
15667200 |
|
1400 |
137270553 |
OLOGY |
C |
Nov. 28, 2021, 5:43 p.m. |
OK |
PyPy 2 |
TESTS |
27 |
373 |
17305600 |
|
1400 |
137261739 |
Believer_Ayush |
C |
Nov. 28, 2021, 4:39 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
218 |
23961600 |
|
1400 |
137269469 |
brthyyjp |
C |
Nov. 28, 2021, 5:35 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
265 |
26419200 |
|
1400 |
137275422 |
Munchy_1 |
C |
Nov. 28, 2021, 6:51 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
280 |
24883200 |
|
1400 |
137272044 |
KeiTsukishima |
C |
Nov. 28, 2021, 6 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
296 |
26828800 |
|
1400 |
137282749 |
Bad_day_toCode |
C |
Nov. 28, 2021, 9:47 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
296 |
28262400 |
|
1400 |
137257215 |
hritik3878 |
C |
Nov. 28, 2021, 4:18 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
311 |
34508800 |
|
1400 |
137279478 |
Coding_RDX |
C |
Nov. 28, 2021, 8:15 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
342 |
24678400 |
|
1400 |
137265182 |
prachir1501 |
C |
Nov. 28, 2021, 4:55 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
342 |
27340800 |
|
1400 |
137261254 |
ashish_sasmal |
C |
Nov. 28, 2021, 4:36 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
342 |
27648000 |
|
1400 |
137281820 |
armsusman |
C |
Nov. 28, 2021, 9:16 p.m. |
OK |
PyPy 3 |
TESTS |
27 |
342 |
28876800 |
|
1400 |
137270547 |
lemiao12 |
C |
Nov. 28, 2021, 5:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
249 |
30515200 |
|
1400 |
137277809 |
_aadiupadhyay_ |
C |
Nov. 28, 2021, 7:38 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
265 |
33996800 |
|
1400 |
137257946 |
lemiao12 |
C |
Nov. 28, 2021, 4:21 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
280 |
39731200 |
|
1400 |
137263721 |
Skillful_Wanderer |
C |
Nov. 28, 2021, 4:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
296 |
34201600 |
|
1400 |
137261893 |
2019286 |
C |
Nov. 28, 2021, 4:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
296 |
42598400 |
|
1400 |
137257733 |
bjy |
C |
Nov. 28, 2021, 4:20 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
327 |
32563200 |
|
1400 |
137261974 |
demony |
C |
Nov. 28, 2021, 4:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
373 |
45465600 |
|
1400 |
137258585 |
HobbitOnWrongPlanet |
C |
Nov. 28, 2021, 4:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
389 |
51609600 |
|
1400 |
137254511 |
Mystic_heap |
C |
Nov. 28, 2021, 4:07 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
390 |
43929600 |
|
1400 |
137272170 |
Spacelessd |
C |
Nov. 28, 2021, 6:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
27 |
405 |
34201600 |
|
1400 |
137272065 |
OLOGY |
C |
Nov. 28, 2021, 6:01 p.m. |
OK |
Python 2 |
TESTS |
27 |
545 |
24166400 |
|
1400 |
137274885 |
OLOGY |
C |
Nov. 28, 2021, 6:42 p.m. |
OK |
Python 2 |
TESTS |
27 |
623 |
27136000 |
|
1400 |
137275066 |
OLOGY |
C |
Nov. 28, 2021, 6:45 p.m. |
OK |
Python 2 |
TESTS |
27 |
624 |
27136000 |
|
1400 |
137272001 |
OLOGY |
C |
Nov. 28, 2021, 6 p.m. |
OK |
Python 2 |
TESTS |
27 |
639 |
23961600 |
|
1400 |
137256903 |
NS3081992 |
C |
Nov. 28, 2021, 4:17 p.m. |
OK |
Python 3 |
TESTS |
27 |
467 |
16998400 |
|
1400 |
137262794 |
essential_sport |
C |
Nov. 28, 2021, 4:44 p.m. |
OK |
Python 3 |
TESTS |
27 |
576 |
18432000 |
|
1400 |
137262854 |
Santhosh44 |
C |
Nov. 28, 2021, 4:44 p.m. |
OK |
Python 3 |
TESTS |
27 |
592 |
18432000 |
|
1400 |
137265240 |
likith_02 |
C |
Nov. 28, 2021, 4:56 p.m. |
OK |
Python 3 |
TESTS |
27 |
701 |
18124800 |
|
1400 |
137252937 |
slskrish1998 |
C |
Nov. 28, 2021, 4:01 p.m. |
OK |
Python 3 |
TESTS |
27 |
701 |
28364800 |
|
1400 |
137267280 |
integer15 |
C |
Nov. 28, 2021, 5:04 p.m. |
OK |
Python 3 |
TESTS |
27 |
717 |
16588800 |
|
1400 |
137283362 |
Kairos |
C |
Nov. 28, 2021, 10:08 p.m. |
OK |
Python 3 |
TESTS |
27 |
717 |
31641600 |
|
1400 |
137255124 |
Greedosaur |
C |
Nov. 28, 2021, 4:09 p.m. |
OK |
Python 3 |
TESTS |
27 |
811 |
18432000 |
|
1400 |
137285291 |
noogler |
C |
Nov. 28, 2021, 11:25 p.m. |
OK |
Rust |
TESTS |
27 |
46 |
15769600 |
|
1400 |
137264427 |
Avanta |
C |
Nov. 28, 2021, 4:52 p.m. |
OK |
Rust |
TESTS |
27 |
327 |
1843200 |
|
1400 |
remove filters
Back to search problems