Codeforces Round 895 (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
1872 Codeforces Round 895 (Div. 3) FINISHED False 8100 37725899 Sept. 7, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 24577 ) D Plus Minus Permutation PROGRAMMING math

B"You are given 3 integers -- n , x , y . Let's call the score of a permutation ^ dagger p_1, ldots, p_n the following value: (p_{1 cdot x} + p_{2 cdot x} + ldots + p_{ lfloor frac{n}{x} rfloor cdot x}) - (p_{1 cdot y} + p_{2 cdot y} + ldots + p_{ lfloor frac{n}{y} rfloor cdot y}) In other words, the score of a permutation is the sum of p_i for all indices i divisible by x , minus the sum of p_i for all indices i divisible by y . You need to find the maximum possible score among all permutations of length n . For example, if n = 7 , x = 2 , y = 3 , the maximum score is achieved by the permutation [2, color{red}{ underline{ color{black}{6}}}, color{blue}{ underline{ color{black}{1}}}, color{red}{ underline{ color{black}{7}}},5, color{blue}{ underline{ color{red}{ underline{ color{black}{4}}}}},3] and is equal to (6 + 7 + 4) - (1 + 4) = 17 - 5 = 12 . ^ dagger A permutation of length n is an array consisting of n distinct integers from 1 to n in any order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (the number 2 appears twice in the array) and [1,3,4] is also not a permutation ( n=3 , but the array contains 4 ). The first line of input contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then follows the description of each test case. The only line of each test case description contains 3 integers n , x , y ( 1 <= n <= 10^9 , 1 <= x, y <= n ). For each test case, output a single integer -- the maximum score among all permutations of length n . The first test case is explained in the problem statement above. In the second test case, one of the optimal permutations will be [12,11, color{blue}{ underline{ color{black}{2}}},4,8, color{blue}{ underline{ color{red}{ underline{"...

Tutorials

Codeforces Round 895 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
222346678 hoakg2000 D Sept. 7, 2023, 5:03 p.m. OK C# 10 TESTS 8 108 2969600
222385301 bluemegane D Sept. 8, 2023, 2:21 a.m. OK C# 8 TESTS 8 202 3174400
222390928 durduryu D Sept. 8, 2023, 3:57 a.m. OK Clang++17 Diagnostics TESTS 8 46 0
222349443 sreejanarsingoju D Sept. 7, 2023, 5:17 p.m. OK Clang++17 Diagnostics TESTS 8 249 0
222385760 Redpo D Sept. 8, 2023, 2:29 a.m. OK Clang++20 Diagnostics TESTS 8 202 0
222349357 abhi____123 D Sept. 7, 2023, 5:16 p.m. OK GNU C11 TESTS 8 62 0
222359444 WASIF_74 D Sept. 7, 2023, 6:35 p.m. OK GNU C11 TESTS 8 62 0
222348152 iffatul_anon D Sept. 7, 2023, 5:10 p.m. OK GNU C11 TESTS 8 62 0
222394273 Jin-Keeper D Sept. 8, 2023, 4:38 a.m. OK GNU C11 TESTS 8 78 0
222399444 beiwwen D Sept. 8, 2023, 5:42 a.m. OK GNU C++14 TESTS 8 15 0
222397145 suru_korlam D Sept. 8, 2023, 5:11 a.m. OK GNU C++14 TESTS 8 15 0
222382548 YeYeYe D Sept. 8, 2023, 1:26 a.m. OK GNU C++14 TESTS 8 15 0
222349129 Reimp D Sept. 7, 2023, 5:15 p.m. OK GNU C++14 TESTS 8 15 0
222347004 Vasudeva.K D Sept. 7, 2023, 5:05 p.m. OK GNU C++14 TESTS 8 15 0
222346996 DreamLover1 D Sept. 7, 2023, 5:05 p.m. OK GNU C++14 TESTS 8 15 0
222347161 shanurocky D Sept. 7, 2023, 5:06 p.m. OK GNU C++14 TESTS 8 15 81408000
222387675 BIOSOIB D Sept. 8, 2023, 3:04 a.m. OK GNU C++14 TESTS 8 30 0
222389405 Zzzyz D Sept. 8, 2023, 3:32 a.m. OK GNU C++14 TESTS 8 30 0
222390489 nhakhoanon D Sept. 8, 2023, 3:50 a.m. OK GNU C++14 TESTS 8 30 0
222379643 applese D Sept. 8, 2023, 12:15 a.m. OK GNU C++17 TESTS 8 15 0
222372149 tuanngoc23022008 D Sept. 7, 2023, 9:22 p.m. OK GNU C++17 TESTS 8 15 0
222367282 Tanvir2000 D Sept. 7, 2023, 8:07 p.m. OK GNU C++17 TESTS 8 15 0
222399278 rahulpant2002 D Sept. 8, 2023, 5:40 a.m. OK GNU C++17 TESTS 8 15 0
222362298 Abdul_Aziz D Sept. 7, 2023, 7:06 p.m. OK GNU C++17 TESTS 8 15 0
222360222 mahir1 D Sept. 7, 2023, 6:43 p.m. OK GNU C++17 TESTS 8 15 0
222366308 vjcp D Sept. 7, 2023, 7:55 p.m. OK GNU C++17 TESTS 8 15 0
222398266 001parte D Sept. 8, 2023, 5:26 a.m. OK GNU C++17 TESTS 8 15 0
222383705 youthPaul D Sept. 8, 2023, 1:51 a.m. OK GNU C++17 TESTS 8 15 0
222382970 zzyhlhdy D Sept. 8, 2023, 1:36 a.m. OK GNU C++17 TESTS 8 15 0
222370287 Linoed D Sept. 7, 2023, 8:50 p.m. OK GNU C++17 (64) TESTS 8 15 0
222389377 092621114sjk D Sept. 8, 2023, 3:32 a.m. OK GNU C++17 (64) TESTS 8 15 0
222384117 Baritra1 D Sept. 8, 2023, 1:59 a.m. OK GNU C++17 (64) TESTS 8 15 0
222374092 Ramy_M_Rashad D Sept. 7, 2023, 9:58 p.m. OK GNU C++17 (64) TESTS 8 15 0
222372330 Agamenon D Sept. 7, 2023, 9:25 p.m. OK GNU C++17 (64) TESTS 8 15 0
222371573 3m_ur D Sept. 7, 2023, 9:13 p.m. OK GNU C++17 (64) TESTS 8 15 0
222369539 CoderAbhi27 D Sept. 7, 2023, 8:38 p.m. OK GNU C++17 (64) TESTS 8 15 0
222369533 akdfjhafjlk D Sept. 7, 2023, 8:38 p.m. OK GNU C++17 (64) TESTS 8 15 0
222367502 kematian D Sept. 7, 2023, 8:10 p.m. OK GNU C++17 (64) TESTS 8 15 0
222358118 Fury D Sept. 7, 2023, 6:22 p.m. OK GNU C++17 (64) TESTS 8 15 0
222377558 Leone_kyoya D Sept. 7, 2023, 11:19 p.m. OK GNU C++20 (64) TESTS 8 0 819200
222399117 suimu D Sept. 8, 2023, 5:38 a.m. OK GNU C++20 (64) TESTS 8 15 0
222397645 gender D Sept. 8, 2023, 5:18 a.m. OK GNU C++20 (64) TESTS 8 15 0
222397571 Suhrobjon D Sept. 8, 2023, 5:17 a.m. OK GNU C++20 (64) TESTS 8 15 0
222397514 smilinginpain D Sept. 8, 2023, 5:16 a.m. OK GNU C++20 (64) TESTS 8 15 0
222399458 LeAnhTu D Sept. 8, 2023, 5:42 a.m. OK GNU C++20 (64) TESTS 8 15 0
222399827 pkp245464 D Sept. 8, 2023, 5:46 a.m. OK GNU C++20 (64) TESTS 8 15 0
222400241 _wHiTe_DeViL_ D Sept. 8, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 8 15 0
222400262 Ikuyo D Sept. 8, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 8 15 0
222397306 ivna D Sept. 8, 2023, 5:13 a.m. OK GNU C++20 (64) TESTS 8 15 0
222356934 vlasashk D Sept. 7, 2023, 6:12 p.m. OK Go TESTS 8 31 819200
222347859 lizenghui1995 D Sept. 7, 2023, 5:09 p.m. OK Go TESTS 8 46 614400
222354533 vijender_8601 D Sept. 7, 2023, 5:52 p.m. OK Java 11 TESTS 8 186 0
222370377 theSSS D Sept. 7, 2023, 8:52 p.m. OK Java 11 TESTS 8 187 0
222358902 Harwinvanak D Sept. 7, 2023, 6:30 p.m. OK Java 11 TESTS 8 187 0
222354079 henrychenOutlook D Sept. 7, 2023, 5:48 p.m. OK Java 11 TESTS 8 187 0
222382927 dugawaarun D Sept. 8, 2023, 1:34 a.m. OK Java 11 TESTS 8 249 0
222358175 singhharman D Sept. 7, 2023, 6:23 p.m. OK Java 11 TESTS 8 280 0
222388824 imsaurabhkhare D Sept. 8, 2023, 3:23 a.m. OK Java 11 TESTS 8 327 0
222366036 SmartCode D Sept. 7, 2023, 7:52 p.m. OK Java 11 TESTS 8 327 0
222357223 codeanand17 D Sept. 7, 2023, 6:15 p.m. OK Java 11 TESTS 8 327 0
222395770 imprakharzz D Sept. 8, 2023, 4:53 a.m. OK Java 11 TESTS 8 343 0
222374840 TheLastDanceCoder D Sept. 7, 2023, 10:13 p.m. OK Java 17 TESTS 8 171 614400
222360723 Legend... D Sept. 7, 2023, 6:48 p.m. OK Java 17 TESTS 8 187 512000
222350445 venkateshyeturi D Sept. 7, 2023, 5:22 p.m. OK Java 17 TESTS 8 202 102400
222353526 ram13413 D Sept. 7, 2023, 5:44 p.m. OK Java 17 TESTS 8 202 716800
222396975 sid234890 D Sept. 8, 2023, 5:08 a.m. OK Java 17 TESTS 8 217 716800
222349407 aquafrost16 D Sept. 7, 2023, 5:17 p.m. OK Java 17 TESTS 8 218 204800
222352019 iamdimonis D Sept. 7, 2023, 5:33 p.m. OK Java 17 TESTS 8 218 512000
222355268 sagnikghoshcr7 D Sept. 7, 2023, 5:57 p.m. OK Java 17 TESTS 8 218 614400
222360373 byte_b D Sept. 7, 2023, 6:45 p.m. OK Java 17 TESTS 8 218 716800
222346397 ahmed.elbakly D Sept. 7, 2023, 5:02 p.m. OK Java 17 TESTS 8 234 0
222376825 Y_T D Sept. 7, 2023, 11 p.m. OK Java 8 TESTS 8 108 0
222362052 This_is_Rish D Sept. 7, 2023, 7:04 p.m. OK Java 8 TESTS 8 139 0
222359587 Sumitsingh7 D Sept. 7, 2023, 6:36 p.m. OK Java 8 TESTS 8 171 5836800
222397459 ZXF_521mua D Sept. 8, 2023, 5:15 a.m. OK Java 8 TESTS 8 234 0
222352944 zeus_3101 D Sept. 7, 2023, 5:40 p.m. OK Java 8 TESTS 8 264 0
222398563 amit_roy D Sept. 8, 2023, 5:30 a.m. OK Java 8 TESTS 8 265 0
222346882 Echo_14 D Sept. 7, 2023, 5:04 p.m. OK Java 8 TESTS 8 389 0
222348005 priyaroy3370 D Sept. 7, 2023, 5:10 p.m. OK Java 8 TESTS 8 389 78028800
222380707 lqj D Sept. 8, 2023, 12:43 a.m. OK MS C++ 2017 TESTS 8 31 0
222367741 Roma_the_king D Sept. 7, 2023, 8:13 p.m. OK MS C++ 2017 TESTS 8 46 0
222357862 Timourka D Sept. 7, 2023, 6:20 p.m. OK MS C++ 2017 TESTS 8 46 0
222349538 rishesh D Sept. 7, 2023, 5:17 p.m. OK MS C++ 2017 TESTS 8 77 0
222401190 lakkimsettisreyas D Sept. 8, 2023, 5:59 a.m. OK MS C++ 2017 TESTS 8 78 0
222385949 name17less D Sept. 8, 2023, 2:33 a.m. OK MS C++ 2017 TESTS 8 78 0
222369227 kiNkraD D Sept. 7, 2023, 8:33 p.m. OK MS C++ 2017 TESTS 8 78 0
222362654 max1313 D Sept. 7, 2023, 7:10 p.m. OK MS C++ 2017 TESTS 8 93 0
222360405 SlayerS D Sept. 7, 2023, 6:45 p.m. OK Node.js TESTS 8 202 5222400
222359769 SlayerS D Sept. 7, 2023, 6:38 p.m. OK Node.js TESTS 8 233 5222400
222392245 grente D Sept. 8, 2023, 4:16 a.m. OK PyPy 3 TESTS 8 171 5734400
222387499 stan23456 D Sept. 8, 2023, 3:01 a.m. OK PyPy 3 TESTS 8 249 8704000
222387589 Sruthi_11 D Sept. 8, 2023, 3:02 a.m. OK PyPy 3 TESTS 8 311 6656000
222346567 william0 D Sept. 7, 2023, 5:03 p.m. OK PyPy 3 TESTS 8 358 7475200
222349206 jvatsal0709 D Sept. 7, 2023, 5:16 p.m. OK PyPy 3 TESTS 8 405 8704000
222364284 udaypnayar D Sept. 7, 2023, 7:30 p.m. OK PyPy 3 TESTS 8 451 10240000
222347651 JB_AT D Sept. 7, 2023, 5:08 p.m. OK PyPy 3 TESTS 8 498 10649600
222390918 grente D Sept. 8, 2023, 3:57 a.m. OK PyPy 3 TESTS 8 607 9113600
222387994 ProCoder12 D Sept. 8, 2023, 3:09 a.m. OK PyPy 3-64 TESTS 8 93 5836800
222391852 harshk_52 D Sept. 8, 2023, 4:11 a.m. OK PyPy 3-64 TESTS 8 108 6246400
222377533 riroan D Sept. 7, 2023, 11:18 p.m. OK PyPy 3-64 TESTS 8 108 6246400
222351564 rmr D Sept. 7, 2023, 5:30 p.m. OK PyPy 3-64 TESTS 8 108 6963200
222346482 sleepingonee D Sept. 7, 2023, 5:03 p.m. OK PyPy 3-64 TESTS 8 108 8601600
222364471 Dert30 D Sept. 7, 2023, 7:32 p.m. OK PyPy 3-64 TESTS 8 109 5939200
222370411 gardengnome D Sept. 7, 2023, 8:52 p.m. OK PyPy 3-64 TESTS 8 109 6041600
222357627 akshay_panwar_01 D Sept. 7, 2023, 6:18 p.m. OK PyPy 3-64 TESTS 8 109 7168000
222353321 alexwice D Sept. 7, 2023, 5:43 p.m. OK PyPy 3-64 TESTS 8 109 7168000
222393538 SapperBeret D Sept. 8, 2023, 4:31 a.m. OK PyPy 3-64 TESTS 8 109 7372800
222388462 ProCoder12 D Sept. 8, 2023, 3:16 a.m. OK Python 3 TESTS 8 61 204800
222365528 Deecey01 D Sept. 7, 2023, 7:45 p.m. OK Python 3 TESTS 8 62 204800
222358496 alexpods D Sept. 7, 2023, 6:26 p.m. OK Python 3 TESTS 8 62 1433600
222348349 mamun_cseian D Sept. 7, 2023, 5:11 p.m. OK Python 3 TESTS 8 108 0
222392508 CF_Soumyajit D Sept. 8, 2023, 4:19 a.m. OK Python 3 TESTS 8 109 0
222387518 sathwik_8008 D Sept. 8, 2023, 3:01 a.m. OK Python 3 TESTS 8 109 0
222384707 KawaiiNahida D Sept. 8, 2023, 2:10 a.m. OK Python 3 TESTS 8 109 0
222367566 rajanlawar_24 D Sept. 7, 2023, 8:11 p.m. OK Python 3 TESTS 8 109 0
222361486 anastasis01 D Sept. 7, 2023, 6:57 p.m. OK Python 3 TESTS 8 109 0
222394922 humblebose D Sept. 8, 2023, 4:45 a.m. OK Python 3 TESTS 8 124 0
222360324 0x81 D Sept. 7, 2023, 6:44 p.m. OK Ruby 3 TESTS 8 296 921600
222361278 matheusdacach D Sept. 7, 2023, 6:54 p.m. OK Rust 2021 TESTS 8 15 0
222375222 TecTrixer D Sept. 7, 2023, 10:21 p.m. OK Rust 2021 TESTS 8 31 0
222375155 TecTrixer D Sept. 7, 2023, 10:20 p.m. OK Rust 2021 TESTS 8 109 0

remove filters

Back to search problems