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 are given two arrays a and b , both of length n . Your task is to count the number of pairs of integers (i,j) such that 1 <= q i < j <= q n and a_i cdot a_j = b_i+b_j . Each test contains multiple test cases. The first line of input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the length of the arrays. The second line of each test case contains n integers a_1,a_2, ldots,a_n ( 1 <= a_i <= n ) -- the elements of array a . The third line of each test case contains n integers b_1,b_2, ldots,b_n ( 1 <= b_i <= n ) -- the elements of array b . It is guaranteed that the sum of n across all test cases does not exceed 2 cdot 10^5 . For each test case, output the number of good pairs. In the first sample, there are 2 good pairs: In the second sample, there are 7 good pairs: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
207661886 |
LeonidR |
B |
May 28, 2023, 4:50 p.m. |
OK |
C# 10 |
TESTS |
19 |
1637 |
39014400 |
|
|
207674792 |
DmitriyAnikeyev |
B |
May 28, 2023, 6:16 p.m. |
OK |
C# 10 |
TESTS |
20 |
2760 |
153292800 |
|
|
207616708 |
mban259 |
B |
May 28, 2023, 3:15 p.m. |
OK |
C# 10 |
TESTS |
19 |
3946 |
69632000 |
|
|
207616755 |
zdc123456 |
B |
May 28, 2023, 3:15 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
218 |
10444800 |
|
|
207699048 |
wutongchun |
B |
May 29, 2023, 2:49 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
249 |
7987200 |
|
|
207645606 |
mat_v |
B |
May 28, 2023, 4:09 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
249 |
9625600 |
|
|
207692615 |
ztcakioi |
B |
May 29, 2023, 12:16 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
265 |
372736000 |
|
|
207671568 |
grass8sheep |
B |
May 28, 2023, 5:51 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
280 |
6451200 |
|
|
207671945 |
Love_forever_you |
B |
May 28, 2023, 5:54 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
311 |
28160000 |
|
|
207649111 |
Rita_Ross |
B |
May 28, 2023, 4:17 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
327 |
8089600 |
|
|
207617677 |
mychecksdead |
B |
May 28, 2023, 3:17 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
327 |
25702400 |
|
|
207612104 |
zltzlt |
B |
May 28, 2023, 3:08 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
374 |
7270400 |
|
|
207630208 |
paul2008 |
B |
May 28, 2023, 3:38 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
374 |
14438400 |
|
|
207677369 |
shinchankosen |
B |
May 28, 2023, 6:40 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
217 |
7168000 |
|
|
207614253 |
tokusakurai |
B |
May 28, 2023, 3:11 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
233 |
7270400 |
|
|
207619104 |
marsxiang5902 |
B |
May 28, 2023, 3:19 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
280 |
11673600 |
|
|
207653012 |
marcOS |
B |
May 28, 2023, 4:27 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
311 |
10444800 |
|
|
207676950 |
CepryH9 |
B |
May 28, 2023, 6:36 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
327 |
2457600 |
|
|
207613124 |
noDreams |
B |
May 28, 2023, 3:10 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
327 |
6041600 |
|
|
207636880 |
dumb_boi |
B |
May 28, 2023, 3:50 p.m. |
OK |
GNU C++17 |
TESTS |
19 |
327 |
11161600 |
|
|
207714251 |
txwd |
B |
May 29, 2023, 5:13 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
358 |
2457600 |
|
|
207709928 |
MarbIue |
B |
May 29, 2023, 4:04 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
358 |
5017600 |
|
|
207712311 |
Linver |
B |
May 29, 2023, 4:44 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
373 |
2457600 |
|
|
207691341 |
chenxiaoyan |
B |
May 28, 2023, 11:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
156 |
9420800 |
|
|
207590424 |
zihouzhong |
B |
May 28, 2023, 2:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
233 |
10240000 |
|
|
207616683 |
fuppy |
B |
May 28, 2023, 3:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
249 |
2457600 |
|
|
207628658 |
fengchang |
B |
May 28, 2023, 3:35 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
295 |
10240000 |
|
|
207714557 |
gqf123 |
B |
May 29, 2023, 5:18 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
296 |
2457600 |
|
|
207677724 |
Toxel |
B |
May 28, 2023, 6:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
311 |
9420800 |
|
|
207674314 |
jz796 |
B |
May 28, 2023, 6:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
312 |
2457600 |
|
|
207622433 |
thisIsMorningstar |
B |
May 28, 2023, 3:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
342 |
15872000 |
|
|
207695282 |
lqx2005 |
B |
May 29, 2023, 1:32 a.m. |
OK |
GNU C++17 (64) |
TESTS |
20 |
343 |
16691200 |
|
|
207601073 |
kevinyang |
B |
May 28, 2023, 2:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
358 |
13516800 |
|
|
207648432 |
heno239 |
B |
May 28, 2023, 4:15 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
139 |
17817600 |
|
|
207621848 |
YouKn0wWho |
B |
May 28, 2023, 3:23 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
155 |
14233600 |
|
|
207596843 |
tourist |
B |
May 28, 2023, 2:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
155 |
17715200 |
|
|
207628711 |
Alfeh |
B |
May 28, 2023, 3:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
171 |
11776000 |
|
|
207676333 |
DDima |
B |
May 28, 2023, 6:29 p.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
187 |
19865600 |
|
|
207608945 |
zemen |
B |
May 28, 2023, 3:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
202 |
9420800 |
|
|
207628498 |
_lbw_ |
B |
May 28, 2023, 3:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
202 |
16588800 |
|
|
207646204 |
Dakovalev1 |
B |
May 28, 2023, 4:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
218 |
7270400 |
|
|
207716841 |
Dhruv_Kushwaha2010 |
B |
May 29, 2023, 5:50 a.m. |
OK |
GNU C++20 (64) |
TESTS |
20 |
249 |
2457600 |
|
|
207601856 |
elycx |
B |
May 28, 2023, 2:55 p.m. |
OK |
GNU C++20 (64) |
TESTS |
19 |
249 |
10240000 |
|
|
207713465 |
0x3F |
B |
May 29, 2023, 5:01 a.m. |
OK |
Go |
TESTS |
20 |
873 |
13721600 |
|
|
207713260 |
0x3F |
B |
May 29, 2023, 4:58 a.m. |
OK |
Go |
TESTS |
20 |
982 |
13721600 |
|
|
207638106 |
profchi |
B |
May 28, 2023, 3:52 p.m. |
OK |
Java 11 |
TESTS |
19 |
3618 |
35840000 |
|
|
207656856 |
cc4414 |
B |
May 28, 2023, 4:37 p.m. |
OK |
Java 8 |
TESTS |
19 |
3775 |
49356800 |
|
|
207643573 |
FastFreeTask |
B |
May 28, 2023, 4:04 p.m. |
OK |
Kotlin 1.6 |
TESTS |
19 |
1481 |
18841600 |
|
|
207601384 |
Tlatoani |
B |
May 28, 2023, 2:54 p.m. |
OK |
Kotlin 1.6 |
TESTS |
19 |
2043 |
530534400 |
|
|
207690459 |
ItsNikolor |
B |
May 28, 2023, 10:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
20 |
624 |
7168000 |
|
|
207690426 |
ItsNikolor |
B |
May 28, 2023, 10:50 p.m. |
OK |
MS C++ 2017 |
TESTS |
20 |
826 |
7987200 |
|
|
207690950 |
coolavy999 |
B |
May 28, 2023, 11:11 p.m. |
OK |
PyPy 3 |
TESTS |
20 |
3837 |
30924800 |
|
|
207692680 |
Little_Sheep_Yawn |
B |
May 29, 2023, 12:19 a.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
1450 |
103526400 |
|
|
207610576 |
misorin |
B |
May 28, 2023, 3:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
1824 |
103321600 |
|
|
207674815 |
bronze_coder |
B |
May 28, 2023, 6:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
2277 |
36249600 |
|
|
207647270 |
plevande |
B |
May 28, 2023, 4:13 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
2620 |
34304000 |
|
|
207654063 |
petamingks |
B |
May 28, 2023, 4:29 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
3291 |
46489600 |
|
|
207621801 |
hxu10 |
B |
May 28, 2023, 3:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
3306 |
55193600 |
|
|
207670569 |
1_2_3_4_5_9 |
B |
May 28, 2023, 5:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
3337 |
79462400 |
|
|
207614779 |
10_11_12 |
B |
May 28, 2023, 3:12 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
3337 |
79462400 |
|
|
207604854 |
chinerist |
B |
May 28, 2023, 2:58 p.m. |
OK |
PyPy 3-64 |
TESTS |
19 |
3665 |
41779200 |
|
|
207708015 |
yeche2023 |
B |
May 29, 2023, 3:32 a.m. |
OK |
PyPy 3-64 |
TESTS |
20 |
3727 |
33280000 |
|
|
207643333 |
RustIsBestLang |
B |
May 28, 2023, 4:03 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
1778 |
27340800 |
|
|
207622151 |
Egor |
B |
May 28, 2023, 3:24 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
2776 |
15155200 |
|
|
207597968 |
sansen |
B |
May 28, 2023, 2:51 p.m. |
OK |
Rust 2021 |
TESTS |
19 |
3384 |
27340800 |
|
|
remove filters
Back to search problems