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'Hossam woke up bored, so he decided to create an interesting array with his friend Hazem. Now, they have an array a of n positive integers, Hossam will choose a number a_i and Hazem will choose a number a_j . Count the number of interesting pairs (a_i, a_j) that meet all the following conditions: The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 100 ), which denotes the number of test cases. Description of the test cases follows. The first line of each test case contains an integer n ( 2 <= n <= 10^5 ). The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^5 ). It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case print an integer -- the number of interesting pairs (a_i, a_j) . In the first example, the two ways are: In the second example, the four ways are: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
184825166 |
PavolKoman |
A |
Dec. 11, 2022, 9:58 p.m. |
OK |
C# 10 |
TESTS |
28 |
61 |
8089600 |
|
|
184813083 |
absa1am |
A |
Dec. 11, 2022, 7:18 p.m. |
OK |
C# 10 |
TESTS |
28 |
77 |
7680000 |
|
|
184826656 |
bluemegane |
A |
Dec. 11, 2022, 10:29 p.m. |
OK |
C# 8 |
TESTS |
28 |
124 |
7884800 |
|
|
184824543 |
basedsaksham |
A |
Dec. 11, 2022, 9:48 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
28 |
420 |
81203200 |
|
|
184837771 |
TimmyL |
A |
Dec. 12, 2022, 3:03 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
0 |
|
|
184831365 |
WilliamLi |
A |
Dec. 12, 2022, 12:41 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
0 |
|
|
184829230 |
11d10xy |
A |
Dec. 11, 2022, 11:37 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
0 |
|
|
184830012 |
sybsyb |
A |
Dec. 12, 2022, midnight |
OK |
GNU C++14 |
TESTS |
28 |
31 |
409600 |
|
|
184815590 |
Syed_Afsani |
A |
Dec. 11, 2022, 7:50 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
409600 |
|
|
184810673 |
mhmuhim |
A |
Dec. 11, 2022, 7:01 p.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
409600 |
|
|
184836809 |
YYMNCLB |
A |
Dec. 12, 2022, 2:47 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
31 |
1638400 |
|
|
184831540 |
zltzlt |
A |
Dec. 12, 2022, 12:45 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
46 |
0 |
|
|
184830910 |
WilliamLi |
A |
Dec. 12, 2022, 12:26 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
46 |
0 |
|
|
184849612 |
Bai_xiaobo |
A |
Dec. 12, 2022, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
28 |
46 |
409600 |
|
|
remove filters
Back to search problems