Codeforces Round 954 (Div. 3)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1986 Codeforces Round 954 (Div. 3) FINISHED False 8100 18025763 June 23, 2024, 2:50 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1143 ) G2 Permutation Problem (Hard Version) PROGRAMMING brute force data structures hashing math number theory

B'This is the hard version of the problem. The only difference is that in this version n <= q 5 cdot 10^5 and the sum of n for all sets of input data does not exceed 5 cdot 10^5 . You are given a permutation p of length n . Calculate the number of index pairs 1 <= q i < j <= q n such that p_i cdot p_j is divisible by i cdot j without remainder. A permutation is a sequence of n integers, in which each integer from 1 to n occurs exactly once. For example, [1] , [3,5,2,1,4] , [1,3,2] are permutations, while [2,3,2] , [4,3,1] , [0] are not. Each test consists of several sets of input data. The first line contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of sets of input data. Then follows their description. The first line of each set of input data contains a single integer n ( 1 <= q n <= q 5 cdot 10^5 ) -- the length of the permutation p . The second line of each set of input data contains n distinct integers p_1, p_2, ldots, p_n ( 1 <= q p_i <= q n ) -- the permutation p . It is guaranteed that the sum of n for all sets of input data does not exceed 5 cdot 10^5 . For each set of input data, output the number of index pairs 1 <= q i < j <= q n such that p_i cdot p_j is divisible by i cdot j without remainder. In the first set of input data, there are no index pairs, as the size of the permutation is 1 . In the second set of input data, there is one index pair (1, 2) and it is valid. In the third set of input data, the index pair (1, 2) is valid. In the fourth set of input data, the index pairs (1, 2) , (1, 5) , and (2, 5) are valid. '...

Tutorials

130762

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
267127886 4977 G2 June 24, 2024, 4:57 a.m. OK C++14 (GCC 6-32) TESTS 80 1265 75366400
267113957 Wuyanru G2 June 24, 2024, 1:26 a.m. OK C++14 (GCC 6-32) TESTS 80 1358 73728000
267132604 heaksicn G2 June 24, 2024, 5:53 a.m. OK C++14 (GCC 6-32) TESTS 80 1640 73318400
267100710 King_of_the_city G2 June 23, 2024, 8:47 p.m. OK C++14 (GCC 6-32) TESTS 80 1655 126361600
267114475 Junz_LJL G2 June 24, 2024, 1:36 a.m. OK C++14 (GCC 6-32) TESTS 80 1796 95539200
267079582 luckyzfy G2 June 23, 2024, 5:12 p.m. OK C++14 (GCC 6-32) TESTS 71 2030 70041600
267082779 omeganot G2 June 23, 2024, 5:31 p.m. OK C++14 (GCC 6-32) TESTS 71 2280 75776000
267109280 Abdullah500 G2 June 23, 2024, 11:32 p.m. OK C++14 (GCC 6-32) TESTS 80 2467 101785600
267082907 omeganot G2 June 23, 2024, 5:32 p.m. OK C++14 (GCC 6-32) TESTS 71 2656 76185600
267082490 omeganot G2 June 23, 2024, 5:29 p.m. OK C++14 (GCC 6-32) TESTS 71 2984 77004800
267088634 temporary1 G2 June 23, 2024, 6:19 p.m. OK C++17 (GCC 7-32) TESTS 71 592 35430400
267096803 Dimitrovsd G2 June 23, 2024, 7:53 p.m. OK C++17 (GCC 7-32) TESTS 71 671 19251200
267090591 temporary1 G2 June 23, 2024, 6:38 p.m. OK C++17 (GCC 7-32) TESTS 71 1046 88883200
267099057 ilyaytrewq G2 June 23, 2024, 8:22 p.m. OK C++17 (GCC 7-32) TESTS 71 1077 17100800
267089848 Mkswll G2 June 23, 2024, 6:30 p.m. OK C++17 (GCC 7-32) TESTS 71 1155 64512000
267099264 ilyaytrewq G2 June 23, 2024, 8:26 p.m. OK C++17 (GCC 7-32) TESTS 71 1156 17100800
267118444 Charming G2 June 24, 2024, 2:50 a.m. OK C++17 (GCC 7-32) TESTS 80 1218 63078400
267077897 Mediocrity G2 June 23, 2024, 5:04 p.m. OK C++17 (GCC 7-32) TESTS 71 1249 70860800
267115290 Bucketsmith G2 June 24, 2024, 1:53 a.m. OK C++17 (GCC 7-32) TESTS 80 1249 95436800
267094713 fahimcp495 G2 June 23, 2024, 7:26 p.m. OK C++17 (GCC 7-32) TESTS 71 1265 59699200
267097911 bye__bye G2 June 23, 2024, 8:07 p.m. OK C++20 (GCC 13-64) TESTS 71 718 18739200
267097849 bye__bye G2 June 23, 2024, 8:06 p.m. OK C++20 (GCC 13-64) TESTS 71 781 18739200
267125266 yangster67 G2 June 24, 2024, 4:25 a.m. OK C++20 (GCC 13-64) TESTS 80 889 96153600
267091478 aryanc403 G2 June 23, 2024, 6:48 p.m. OK C++20 (GCC 13-64) TESTS 71 968 106700800
267091514 aryanc403 G2 June 23, 2024, 6:49 p.m. OK C++20 (GCC 13-64) TESTS 71 983 119296000
267112600 eggag32 G2 June 24, 2024, 12:55 a.m. OK C++20 (GCC 13-64) TESTS 80 1015 97075200
267096725 UdtaDegen_11 G2 June 23, 2024, 7:51 p.m. OK C++20 (GCC 13-64) TESTS 71 1030 43724800
267075835 ganeid G2 June 23, 2024, 5:02 p.m. OK C++20 (GCC 13-64) TESTS 71 1046 43724800
267080446 g_x_j G2 June 23, 2024, 5:17 p.m. OK C++20 (GCC 13-64) TESTS 71 1077 104448000
267128972 coderdhanraj G2 June 24, 2024, 5:11 a.m. OK C++20 (GCC 13-64) TESTS 80 1077 108441600
267098917 misorin G2 June 23, 2024, 8:21 p.m. OK PyPy 3 TESTS 71 1718 55603200
267098743 misorin G2 June 23, 2024, 8:18 p.m. OK PyPy 3 TESTS 71 1718 60416000
267116790 KingofCSES G2 June 24, 2024, 2:22 a.m. OK PyPy 3 TESTS 80 2030 55500800
267097792 misorin G2 June 23, 2024, 8:05 p.m. OK PyPy 3-64 TESTS 71 2061 91443200
267098510 misorin G2 June 23, 2024, 8:15 p.m. OK PyPy 3-64 TESTS 71 2249 111411200
267108179 helli5.tech G2 June 23, 2024, 11:07 p.m. OK PyPy 3-64 TESTS 80 2406 106905600
267111567 lrvideckis G2 June 24, 2024, 12:29 a.m. OK Rust 2021 TESTS 80 983 96563200

remove filters

Back to search problems