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"You have an array a of length n . Your task is to answer q queries: given x,y , find the number of pairs i and j ( 1 <= i < j <= n ) that both a_i + a_j = x and a_i cdot a_j = y . That is, for the array [1,3,2] and asking for x=3,y=2 the answer is 1 : The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The second line of each test case contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the length of the array a . The third line of each test case contains n integers a_1,a_2, ... ,a_n ( 1 <= |a_i| <= 10^9 ) -- array a . The fourth line of each test case contains the integer q ( 1 <= q <= 2 cdot 10^5 ) -- the number of requests. The next q lines contain two numbers each x and y ( 1 <= |x| <= 2 cdot 10^9,1 <= |y| <= 10^{18} ) -- request. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . This is also guaranteed for the sum of q values. For each test case print a line with q numbers -- the answers to the queries. For the first test case, let's analyze each pair of numbers separately: In the second test case, all combinations of pairs are suitable. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
217756781 |
EternityPure |
F |
Aug. 7, 2023, 6:51 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
28 |
1263 |
2867200 |
|
|
217742718 |
SKAPhantom |
F |
Aug. 7, 2023, 5:12 p.m. |
OK |
D |
TESTS |
28 |
374 |
13516800 |
|
|
217754266 |
ruban |
F |
Aug. 7, 2023, 6:29 p.m. |
OK |
FPC |
TESTS |
28 |
951 |
96460800 |
|
|
217756729 |
NenadDapic |
F |
Aug. 7, 2023, 6:51 p.m. |
OK |
FPC |
TESTS |
28 |
1466 |
1638400 |
|
|
217787523 |
zhangzhimo |
F |
Aug. 8, 2023, 2:48 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
155 |
20889600 |
|
|
217799694 |
zhangzhimo |
F |
Aug. 8, 2023, 3:29 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
171 |
20889600 |
|
|
217750354 |
yash_9a3b |
F |
Aug. 7, 2023, 5:59 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
249 |
2355200 |
|
|
217760469 |
exulansis |
F |
Aug. 7, 2023, 7:26 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
249 |
3993600 |
|
|
217808393 |
codeforces_pupil |
F |
Aug. 8, 2023, 5:14 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
249 |
8806400 |
|
|
217782992 |
zhangzhimo |
F |
Aug. 8, 2023, 1:57 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
249 |
19251200 |
|
|
217750518 |
yash_9a3b |
F |
Aug. 7, 2023, 6 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
264 |
2355200 |
|
|
217746609 |
_dipu |
F |
Aug. 7, 2023, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
264 |
2764800 |
|
|
217793318 |
Naam_20 |
F |
Aug. 8, 2023, 2:51 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
265 |
2355200 |
|
|
217760305 |
itdobelikethat3899 |
F |
Aug. 7, 2023, 7:24 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
265 |
2355200 |
|
|
217806529 |
Hex-willappear |
F |
Aug. 8, 2023, 4:54 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
2150400 |
|
|
217808545 |
kujwal |
F |
Aug. 8, 2023, 5:16 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
2560000 |
|
|
217804520 |
wdgkd |
F |
Aug. 8, 2023, 4:28 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
4198400 |
|
|
217746497 |
chuchuching |
F |
Aug. 7, 2023, 5:34 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
5017600 |
|
|
217763876 |
CSHwang |
F |
Aug. 7, 2023, 8:01 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
249 |
5632000 |
|
|
217755769 |
admirerider |
F |
Aug. 7, 2023, 6:43 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
264 |
4198400 |
|
|
217744108 |
bhole_121 |
F |
Aug. 7, 2023, 5:19 p.m. |
OK |
GNU C++17 |
TESTS |
28 |
264 |
4198400 |
|
|
217808508 |
7y29 |
F |
Aug. 8, 2023, 5:15 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
264 |
6144000 |
|
|
217806441 |
Hex-willappear |
F |
Aug. 8, 2023, 4:53 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
265 |
2150400 |
|
|
217787371 |
Raven_c |
F |
Aug. 8, 2023, 2:47 a.m. |
OK |
GNU C++17 |
TESTS |
28 |
265 |
2560000 |
|
|
217800998 |
chfychin |
F |
Aug. 8, 2023, 3:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
186 |
5734400 |
|
|
217747996 |
wqweto |
F |
Aug. 7, 2023, 5:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
202 |
2457600 |
|
|
217797846 |
wuzihan |
F |
Aug. 8, 2023, 3:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
202 |
2560000 |
|
|
217808976 |
deepanshusau |
F |
Aug. 8, 2023, 5:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
217 |
2560000 |
|
|
217744176 |
Once_I_Liked_AGirl |
F |
Aug. 7, 2023, 5:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
218 |
5017600 |
|
|
217750736 |
Linver |
F |
Aug. 7, 2023, 6:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
233 |
2457600 |
|
|
217742126 |
Once_I_Liked_AGirl |
F |
Aug. 7, 2023, 5:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
249 |
5017600 |
|
|
217778904 |
Fakedreamer |
F |
Aug. 8, 2023, 1:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
264 |
5324800 |
|
|
217785759 |
lincid |
F |
Aug. 8, 2023, 2:28 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
264 |
5529600 |
|
|
217778959 |
z100626 |
F |
Aug. 8, 2023, 1:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
28 |
264 |
11776000 |
|
|
217803517 |
bigJ |
F |
Aug. 8, 2023, 4:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
124 |
3174400 |
|
|
217798905 |
snowy2002 |
F |
Aug. 8, 2023, 3:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
124 |
6758400 |
|
|
217805065 |
sarthak.cpp |
F |
Aug. 8, 2023, 4:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
139 |
2662400 |
|
|
217784903 |
star6.6 |
F |
Aug. 8, 2023, 2:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
139 |
2662400 |
|
|
217779490 |
bigJ |
F |
Aug. 8, 2023, 1:14 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
139 |
3174400 |
|
|
217742735 |
asaringo |
F |
Aug. 7, 2023, 5:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
139 |
5632000 |
|
|
217755084 |
ahmedtawfik |
F |
Aug. 7, 2023, 6:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
139 |
6758400 |
|
|
217811743 |
Pendem |
F |
Aug. 8, 2023, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
140 |
2662400 |
|
|
217803504 |
new_Sheth_Atitya |
F |
Aug. 8, 2023, 4:13 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
140 |
2662400 |
|
|
217779170 |
bigJ |
F |
Aug. 8, 2023, 1:09 a.m. |
OK |
GNU C++20 (64) |
TESTS |
28 |
140 |
3174400 |
|
|
217756793 |
O_Vladimir |
F |
Aug. 7, 2023, 6:51 p.m. |
OK |
Go |
TESTS |
28 |
389 |
10035200 |
|
|
217753816 |
Panther369 |
F |
Aug. 7, 2023, 6:25 p.m. |
OK |
Java 11 |
TESTS |
28 |
498 |
3379200 |
|
|
217777647 |
Yousef_Badr |
F |
Aug. 8, 2023, 12:45 a.m. |
OK |
Java 11 |
TESTS |
28 |
530 |
0 |
|
|
217806907 |
bobib |
F |
Aug. 8, 2023, 4:57 a.m. |
OK |
Java 11 |
TESTS |
28 |
545 |
2355200 |
|
|
217776808 |
Yousef_Badr |
F |
Aug. 8, 2023, 12:27 a.m. |
OK |
Java 11 |
TESTS |
28 |
717 |
0 |
|
|
217763146 |
princeayush04 |
F |
Aug. 7, 2023, 7:53 p.m. |
OK |
Java 11 |
TESTS |
28 |
748 |
0 |
|
|
217780579 |
codingIsFun1234 |
F |
Aug. 8, 2023, 1:28 a.m. |
OK |
Java 11 |
TESTS |
28 |
935 |
204800 |
|
|
217748456 |
Saoge |
F |
Aug. 7, 2023, 5:46 p.m. |
OK |
Java 11 |
TESTS |
28 |
1200 |
204800 |
|
|
217809428 |
snkv |
F |
Aug. 8, 2023, 5:25 a.m. |
OK |
Java 11 |
TESTS |
28 |
1216 |
13721600 |
|
|
217768401 |
snkv |
F |
Aug. 7, 2023, 9:07 p.m. |
OK |
Java 11 |
TESTS |
28 |
1294 |
13721600 |
|
|
217761043 |
butteronpoptart |
F |
Aug. 7, 2023, 7:31 p.m. |
OK |
Java 11 |
TESTS |
28 |
1793 |
0 |
|
|
217752099 |
wkoder |
F |
Aug. 7, 2023, 6:12 p.m. |
OK |
Java 17 |
TESTS |
28 |
358 |
409600 |
|
|
217801242 |
KAZHYI |
F |
Aug. 8, 2023, 3:47 a.m. |
OK |
Java 17 |
TESTS |
28 |
498 |
1536000 |
|
|
217797873 |
cosenza |
F |
Aug. 8, 2023, 3:09 a.m. |
OK |
Java 17 |
TESTS |
28 |
545 |
716800 |
|
|
217752211 |
tbs-jyy |
F |
Aug. 7, 2023, 6:13 p.m. |
OK |
Java 17 |
TESTS |
28 |
561 |
1024000 |
|
|
217801878 |
KAZHYI |
F |
Aug. 8, 2023, 3:54 a.m. |
OK |
Java 17 |
TESTS |
28 |
592 |
512000 |
|
|
217745976 |
miminguci |
F |
Aug. 7, 2023, 5:30 p.m. |
OK |
Java 17 |
TESTS |
28 |
608 |
36659200 |
|
|
217742847 |
chenxiaoming |
F |
Aug. 7, 2023, 5:13 p.m. |
OK |
Java 17 |
TESTS |
28 |
654 |
2969600 |
|
|
217798405 |
not_just_rr |
F |
Aug. 8, 2023, 3:14 a.m. |
OK |
Java 17 |
TESTS |
28 |
826 |
9113600 |
|
|
217745940 |
Mo.Mostafa2 |
F |
Aug. 7, 2023, 5:30 p.m. |
OK |
Java 17 |
TESTS |
28 |
2277 |
1024000 |
|
|
217796442 |
cosenza |
F |
Aug. 8, 2023, 2:54 a.m. |
OK |
Java 17 |
TESTS |
28 |
2292 |
1126400 |
|
|
217799683 |
chuquwan9964 |
F |
Aug. 8, 2023, 3:29 a.m. |
OK |
Java 8 |
TESTS |
28 |
327 |
0 |
|
|
217800863 |
qwytest |
F |
Aug. 8, 2023, 3:42 a.m. |
OK |
Java 8 |
TESTS |
28 |
358 |
4505600 |
|
|
217800826 |
qwytest |
F |
Aug. 8, 2023, 3:42 a.m. |
OK |
Java 8 |
TESTS |
28 |
374 |
4505600 |
|
|
217773437 |
yadavDipesh |
F |
Aug. 7, 2023, 11:05 p.m. |
OK |
Java 8 |
TESTS |
28 |
389 |
0 |
|
|
217797763 |
roeyr |
F |
Aug. 8, 2023, 3:08 a.m. |
OK |
Java 8 |
TESTS |
28 |
389 |
3584000 |
|
|
217773508 |
yadavDipesh |
F |
Aug. 7, 2023, 11:07 p.m. |
OK |
Java 8 |
TESTS |
28 |
405 |
0 |
|
|
217749458 |
NerfThis |
F |
Aug. 7, 2023, 5:53 p.m. |
OK |
Java 8 |
TESTS |
28 |
436 |
5120000 |
|
|
217756790 |
Mohamed_Ahmed |
F |
Aug. 7, 2023, 6:51 p.m. |
OK |
Java 8 |
TESTS |
28 |
436 |
5632000 |
|
|
217811779 |
Java_Programmer |
F |
Aug. 8, 2023, 5:50 a.m. |
OK |
Java 8 |
TESTS |
28 |
451 |
4608000 |
|
|
217751239 |
American_Eagle |
F |
Aug. 7, 2023, 6:06 p.m. |
OK |
Java 8 |
TESTS |
28 |
1107 |
5529600 |
|
|
217766057 |
xyxoro |
F |
Aug. 7, 2023, 8:27 p.m. |
OK |
PyPy 3 |
TESTS |
28 |
638 |
37580800 |
|
|
217762952 |
Naughty_Tactician |
F |
Aug. 7, 2023, 7:51 p.m. |
OK |
PyPy 3 |
TESTS |
28 |
1388 |
20787200 |
|
|
217793335 |
WalrusRamen21 |
F |
Aug. 8, 2023, 2:51 a.m. |
OK |
PyPy 3 |
TESTS |
28 |
1450 |
19558400 |
|
|
217741122 |
lanbae |
F |
Aug. 7, 2023, 5:05 p.m. |
OK |
PyPy 3 |
TESTS |
28 |
2698 |
19148800 |
|
|
217741581 |
dylan1006498 |
F |
Aug. 7, 2023, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
28 |
2745 |
19148800 |
|
|
217750633 |
crescmoon |
F |
Aug. 7, 2023, 6:01 p.m. |
OK |
PyPy 3 |
TESTS |
28 |
3400 |
19251200 |
|
|
217787389 |
WalrusRamen21 |
F |
Aug. 8, 2023, 2:47 a.m. |
OK |
PyPy 3 |
TESTS |
28 |
3618 |
22630400 |
|
|
217803378 |
Mohamed_Hamed |
F |
Aug. 8, 2023, 4:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
342 |
32972800 |
|
|
217744439 |
linhua |
F |
Aug. 7, 2023, 5:21 p.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
342 |
39424000 |
|
|
217752045 |
Lotrick |
F |
Aug. 7, 2023, 6:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
343 |
27750400 |
|
|
217781227 |
flexr |
F |
Aug. 8, 2023, 1:37 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
358 |
28057600 |
|
|
217787416 |
gardengnome |
F |
Aug. 8, 2023, 2:47 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
358 |
32153600 |
|
|
217796539 |
gardengnome |
F |
Aug. 8, 2023, 2:55 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
374 |
26419200 |
|
|
217777128 |
hvbird |
F |
Aug. 8, 2023, 12:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
389 |
27033600 |
|
|
217743720 |
iN_siDious |
F |
Aug. 7, 2023, 5:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
389 |
31232000 |
|
|
217777674 |
Dert30 |
F |
Aug. 8, 2023, 12:45 a.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
405 |
25497600 |
|
|
217765248 |
kbelyaev |
F |
Aug. 7, 2023, 8:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
28 |
405 |
26828800 |
|
|
217785954 |
ajxu2 |
F |
Aug. 8, 2023, 2:31 a.m. |
OK |
Python 3 |
TESTS |
28 |
841 |
34713600 |
|
|
217799550 |
sukaya |
F |
Aug. 8, 2023, 3:28 a.m. |
OK |
Python 3 |
TESTS |
28 |
857 |
27955200 |
|
|
217804004 |
k_umeshchandra |
F |
Aug. 8, 2023, 4:21 a.m. |
OK |
Python 3 |
TESTS |
28 |
873 |
26726400 |
|
|
217747748 |
abhisheksanwal745 |
F |
Aug. 7, 2023, 5:42 p.m. |
OK |
Python 3 |
TESTS |
28 |
935 |
59187200 |
|
|
217758838 |
jaiswaljiya001 |
F |
Aug. 7, 2023, 7:09 p.m. |
OK |
Python 3 |
TESTS |
28 |
966 |
26521600 |
|
|
217766857 |
laala |
F |
Aug. 7, 2023, 8:38 p.m. |
OK |
Python 3 |
TESTS |
28 |
1044 |
26316800 |
|
|
217759424 |
Freiden |
F |
Aug. 7, 2023, 7:15 p.m. |
OK |
Python 3 |
TESTS |
28 |
2136 |
29388800 |
|
|
217744230 |
KAMITO |
F |
Aug. 7, 2023, 5:20 p.m. |
OK |
Python 3 |
TESTS |
28 |
3415 |
26316800 |
|
|
217779854 |
bqn |
F |
Aug. 8, 2023, 1:18 a.m. |
OK |
Rust 2021 |
TESTS |
28 |
124 |
20070400 |
|
|
217750407 |
haihamabossu |
F |
Aug. 7, 2023, 6 p.m. |
OK |
Rust 2021 |
TESTS |
28 |
187 |
16998400 |
|
|
remove filters
Back to search problems