Codeforces Round 852 (Div. 2)

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
1793 Codeforces Round 852 (Div. 2) FINISHED False 7200 55632299 Feb. 12, 2023, 8:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 18118 ) A Yet Another Promotion PROGRAMMING greedy math

B'The famous store "Second Food" sells groceries only two days a month. And the prices in each of days differ. You wanted to buy n kilos of potatoes for a month. You know that on the first day of the month 1 kilo of potatoes costs a coins, and on the second day b coins. In "Second Food" you can buy any integer kilograms of potatoes. Fortunately, "Second Food" has announced a promotion for potatoes, which is valid only on the first day of the month -- for each m kilos of potatoes you buy, you get 1 kilo as a gift! In other words, you can get m + 1 kilograms by paying for m kilograms. Find the minimum number of coins that you have to spend to buy at least n kilos of potatoes. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10 ,000 ). Description of the test cases follows. The first line of each test case contains two integers a and b (1 <= q a, b <= q 10^9) -- the prices of 1 kilo of potatoes on the first and second days, respectively. The second line contains two integers n and m (1 <= q n, m <= q 10^9) -- the required amount of potatoes to buy and the amount of potatoes to use the promotion. For each test case print one integer -- the minimum number of coins that you have to pay to buy at least n kilos of potatoes. In the first test case, on the first day you buy 1 kilo and get 1 more for a promotion. On the second day, you can buy 1 kilo of potatoes. Thus, you will spend 5+4=9 coins in total. In the second test case, on the first day you buy 2 kilo and get another 1 more for a promotion. This way you will spend 2 cdot 5 = 10 coins. '...

Tutorials

Codeforces Round #852 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
193338244 PavolKoman A Feb. 12, 2023, 11:39 a.m. OK C# 10 TESTS 7 93 3072000
193384828 chopin123 A Feb. 12, 2023, 6:20 p.m. OK C# 8 TESTS 7 233 3276800
193370840 mdshadesh A Feb. 12, 2023, 4:23 p.m. OK Clang++17 Diagnostics TESTS 7 46 0
193381009 mister_Aj A Feb. 12, 2023, 5:47 p.m. OK Clang++17 Diagnostics TESTS 7 326 0
193419812 Rudrik A Feb. 13, 2023, 4:55 a.m. OK Clang++17 Diagnostics TESTS 7 327 0
193421485 Joe_yue6 A Feb. 13, 2023, 5:24 a.m. OK Clang++20 Diagnostics TESTS 7 280 0
193381217 nolutyagi2616 A Feb. 12, 2023, 5:49 p.m. OK Clang++20 Diagnostics TESTS 7 311 0
193400562 nolutyagi2616 A Feb. 12, 2023, 9:17 p.m. OK Clang++20 Diagnostics TESTS 7 327 0
193412098 Smallorange A Feb. 13, 2023, 1:59 a.m. OK GNU C11 TESTS 7 61 0
193357759 HV206 A Feb. 12, 2023, 2:30 p.m. OK GNU C11 TESTS 7 62 0
193373456 C223056_farhad A Feb. 12, 2023, 4:45 p.m. OK GNU C11 TESTS 7 62 0
193376299 _M7s3c7 A Feb. 12, 2023, 5:08 p.m. OK GNU C11 TESTS 7 62 0
193380925 Mushfiqur_ A Feb. 12, 2023, 5:47 p.m. OK GNU C11 TESTS 7 62 0
193382776 priyanshu.sharma2612 A Feb. 12, 2023, 6:03 p.m. OK GNU C11 TESTS 7 62 0
193385204 nahidnahidurrahman4 A Feb. 12, 2023, 6:23 p.m. OK GNU C11 TESTS 7 62 0
193341950 1419__ A Feb. 12, 2023, 12:11 p.m. OK GNU C11 TESTS 7 62 0
193343151 yash_barge A Feb. 12, 2023, 12:23 p.m. OK GNU C11 TESTS 7 62 0
193343857 Ashwin_agr A Feb. 12, 2023, 12:29 p.m. OK GNU C11 TESTS 7 62 0
193387456 sachin.shaw.ece20 A Feb. 12, 2023, 6:44 p.m. OK GNU C++14 TESTS 7 15 0
193365427 Commonrain A Feb. 12, 2023, 3:35 p.m. OK GNU C++14 TESTS 7 15 0
193355464 lost1903 A Feb. 12, 2023, 2:10 p.m. OK GNU C++14 TESTS 7 15 0
193414343 liaopengfei A Feb. 13, 2023, 2:54 a.m. OK GNU C++14 TESTS 7 15 0
193338386 Ke_lanjie A Feb. 12, 2023, 11:40 a.m. OK GNU C++14 TESTS 7 15 0
193380997 error_202 A Feb. 12, 2023, 5:47 p.m. OK GNU C++14 TESTS 7 15 3379200
193397850 XHYMathematics A Feb. 12, 2023, 8:38 p.m. OK GNU C++14 TESTS 7 30 0
193421915 kingsman007 A Feb. 13, 2023, 5:31 a.m. OK GNU C++14 TESTS 7 30 0
193416510 2745518585 A Feb. 13, 2023, 3:45 a.m. OK GNU C++14 TESTS 7 30 0
193408496 WinResearcher A Feb. 13, 2023, 12:11 a.m. OK GNU C++14 TESTS 7 30 0
193337811 AbeedShaik A Feb. 12, 2023, 11:36 a.m. OK GNU C++17 TESTS 7 15 0
193370641 kaushalShinde A Feb. 12, 2023, 4:21 p.m. OK GNU C++17 TESTS 7 15 0
193370703 kausha A Feb. 12, 2023, 4:22 p.m. OK GNU C++17 TESTS 7 15 0
193375252 Ansh.exe A Feb. 12, 2023, 5 p.m. OK GNU C++17 TESTS 7 15 0
193376940 Tushar_1205 A Feb. 12, 2023, 5:13 p.m. OK GNU C++17 TESTS 7 15 0
193390692 qwerty2300730 A Feb. 12, 2023, 7:17 p.m. OK GNU C++17 TESTS 7 15 0
193417556 tesst999 A Feb. 13, 2023, 4:11 a.m. OK GNU C++17 TESTS 7 15 0
193364376 Sherlocked_Potter A Feb. 12, 2023, 3:26 p.m. OK GNU C++17 TESTS 7 15 0
193344481 power_verse A Feb. 12, 2023, 12:35 p.m. OK GNU C++17 TESTS 7 15 0
193339765 Vikasyamsani0212 A Feb. 12, 2023, 11:52 a.m. OK GNU C++17 TESTS 7 15 0
193384578 shrutiavhad2306 A Feb. 12, 2023, 6:18 p.m. OK GNU C++17 (64) TESTS 7 15 0
193405878 Rania A Feb. 12, 2023, 11 p.m. OK GNU C++17 (64) TESTS 7 15 0
193387386 harshbadaya007 A Feb. 12, 2023, 6:43 p.m. OK GNU C++17 (64) TESTS 7 15 0
193379104 ithinkimloosingmymind A Feb. 12, 2023, 5:31 p.m. OK GNU C++17 (64) TESTS 7 15 0
193335097 deepak_sriram A Feb. 12, 2023, 11:15 a.m. OK GNU C++17 (64) TESTS 7 15 0
193331572 ashiqi2 A Feb. 12, 2023, 10:34 a.m. OK GNU C++17 (64) TESTS 7 15 0
193329905 Bhola_Bhai A Feb. 12, 2023, 10:31 a.m. OK GNU C++17 (64) TESTS 7 15 0
193334799 _rAkib A Feb. 12, 2023, 11:13 a.m. OK GNU C++17 (64) TESTS 7 15 307200
193338771 UltramanDecker A Feb. 12, 2023, 11:43 a.m. OK GNU C++17 (64) TESTS 7 15 307200
193421823 Monir A Feb. 13, 2023, 5:30 a.m. OK GNU C++17 (64) TESTS 7 30 0
193417724 Lekerr A Feb. 13, 2023, 4:13 a.m. OK GNU C++20 (64) TESTS 7 15 0
193420082 Bronya147 A Feb. 13, 2023, 5 a.m. OK GNU C++20 (64) TESTS 7 15 0
193421822 100galib A Feb. 13, 2023, 5:29 a.m. OK GNU C++20 (64) TESTS 7 15 0
193422241 nahian00777 A Feb. 13, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 7 15 0
193422249 SodiumSilicate A Feb. 13, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 7 15 0
193422416 Bihongo A Feb. 13, 2023, 5:39 a.m. OK GNU C++20 (64) TESTS 7 15 0
193422983 ami_2025 A Feb. 13, 2023, 5:49 a.m. OK GNU C++20 (64) TESTS 7 15 0
193419260 zhangzs A Feb. 13, 2023, 4:45 a.m. OK GNU C++20 (64) TESTS 7 15 0
193419139 arpitkus A Feb. 13, 2023, 4:43 a.m. OK GNU C++20 (64) TESTS 7 15 0
193418120 Marslai24 A Feb. 13, 2023, 4:22 a.m. OK GNU C++20 (64) TESTS 7 15 0
193401766 as9274 A Feb. 12, 2023, 9:37 p.m. OK Java 11 TESTS 7 171 0
193372909 vijender_8601 A Feb. 12, 2023, 4:40 p.m. OK Java 11 TESTS 7 186 0
193357170 Panther369 A Feb. 12, 2023, 2:25 p.m. OK Java 11 TESTS 7 187 0
193365545 Extradict A Feb. 12, 2023, 3:36 p.m. OK Java 11 TESTS 7 202 0
193416062 rajgupta77540 A Feb. 13, 2023, 3:36 a.m. OK Java 11 TESTS 7 217 0
193361045 Darcy__ A Feb. 12, 2023, 2:58 p.m. OK Java 11 TESTS 7 218 0
193336913 Kempachi A Feb. 12, 2023, 11:28 a.m. OK Java 11 TESTS 7 264 0
193340829 SAY_NO_TO_EDITORIAL A Feb. 12, 2023, 12:01 p.m. OK Java 11 TESTS 7 265 0
193391600 creativegiant A Feb. 12, 2023, 7:26 p.m. OK Java 11 TESTS 7 280 0
193355276 xoniq A Feb. 12, 2023, 2:08 p.m. OK Java 11 TESTS 7 280 40243200
193391033 The_Dark_Lord_9635 A Feb. 12, 2023, 7:20 p.m. OK Java 17 TESTS 7 155 102400
193390430 Danger_Don A Feb. 12, 2023, 7:14 p.m. OK Java 17 TESTS 7 202 614400
193388540 jimmyd211 A Feb. 12, 2023, 6:55 p.m. OK Java 17 TESTS 7 217 512000
193353745 Black-Heart A Feb. 12, 2023, 1:55 p.m. OK Java 17 TESTS 7 218 512000
193360031 ahmed.elbakly A Feb. 12, 2023, 2:50 p.m. OK Java 17 TESTS 7 233 102400
193334956 kaifkhan. A Feb. 12, 2023, 11:14 a.m. OK Java 17 TESTS 7 248 102400
193412847 arpurush A Feb. 13, 2023, 2:18 a.m. OK Java 17 TESTS 7 249 0
193345853 bleach__ A Feb. 12, 2023, 12:48 p.m. OK Java 17 TESTS 7 264 204800
193338042 Abhinav__hadole A Feb. 12, 2023, 11:37 a.m. OK Java 17 TESTS 7 311 409600
193363391 FalconSD_7 A Feb. 12, 2023, 3:17 p.m. OK Java 17 TESTS 7 311 819200
193419844 vkukretiwork A Feb. 13, 2023, 4:56 a.m. OK Java 8 TESTS 7 108 0
193421146 Socrates1232 A Feb. 13, 2023, 5:18 a.m. OK Java 8 TESTS 7 108 0
193385442 vaibhav_1710 A Feb. 12, 2023, 6:25 p.m. OK Java 8 TESTS 7 108 0
193358353 ankit_0207 A Feb. 12, 2023, 2:35 p.m. OK Java 8 TESTS 7 109 0
193364119 Divyanshuverma21 A Feb. 12, 2023, 3:23 p.m. OK Java 8 TESTS 7 124 0
193355633 1091857051 A Feb. 12, 2023, 2:11 p.m. OK Java 8 TESTS 7 124 0
193341025 anshulchou_123 A Feb. 12, 2023, 12:03 p.m. OK Java 8 TESTS 7 124 0
193363722 Divyanshuverma21 A Feb. 12, 2023, 3:20 p.m. OK Java 8 TESTS 7 139 0
193338180 Kuntal990 A Feb. 12, 2023, 11:38 a.m. OK Java 8 TESTS 7 139 38195200
193372246 Divyansh_3103 A Feb. 12, 2023, 4:35 p.m. OK Java 8 TESTS 7 171 0
193348249 tdawawd A Feb. 12, 2023, 1:09 p.m. OK MS C++ 2017 TESTS 7 31 0
193421898 SmilingBraniac A Feb. 13, 2023, 5:31 a.m. OK MS C++ 2017 TESTS 7 46 0
193375398 mark77 A Feb. 12, 2023, 5:01 p.m. OK MS C++ 2017 TESTS 7 46 0
193341059 karina.chernookaja A Feb. 12, 2023, 12:03 p.m. OK MS C++ 2017 TESTS 7 77 0
193335805 Tory_A A Feb. 12, 2023, 11:19 a.m. OK MS C++ 2017 TESTS 7 77 0
193358349 adesh123 A Feb. 12, 2023, 2:35 p.m. OK MS C++ 2017 TESTS 7 78 0
193413650 ishybee A Feb. 13, 2023, 2:37 a.m. OK MS C++ 2017 TESTS 7 92 0
193341270 georgii03 A Feb. 12, 2023, 12:05 p.m. OK MS C++ 2017 TESTS 7 93 0
193368641 Yash_Nandwana A Feb. 12, 2023, 4:05 p.m. OK PyPy 3 TESTS 7 233 9420800
193384368 ankitesh A Feb. 12, 2023, 6:17 p.m. OK PyPy 3 TESTS 7 249 9625600
193419211 KeiTsukishima A Feb. 13, 2023, 4:44 a.m. OK PyPy 3 TESTS 7 358 11776000
193377132 meet3447 A Feb. 12, 2023, 5:15 p.m. OK PyPy 3 TESTS 7 421 9830400
193389537 khonshu_99 A Feb. 12, 2023, 7:04 p.m. OK PyPy 3 TESTS 7 452 9932800
193344011 Ankush_tonde A Feb. 12, 2023, 12:31 p.m. OK PyPy 3 TESTS 7 467 9523200
193343226 Ankush_tonde A Feb. 12, 2023, 12:24 p.m. OK PyPy 3 TESTS 7 467 9932800
193417477 bpdolson A Feb. 13, 2023, 4:09 a.m. OK PyPy 3 TESTS 7 482 9625600
193337730 anushka8104 A Feb. 12, 2023, 11:35 a.m. OK PyPy 3 TESTS 7 498 9523200
193367651 dorissssy A Feb. 12, 2023, 3:55 p.m. OK PyPy 3 TESTS 7 498 9932800
193363980 beethoven97 A Feb. 12, 2023, 3:22 p.m. OK PyPy 3-64 TESTS 7 109 6860800
193337703 adithya1207 A Feb. 12, 2023, 11:35 a.m. OK PyPy 3-64 TESTS 7 109 8294400
193358014 SophieHatter A Feb. 12, 2023, 2:32 p.m. OK PyPy 3-64 TESTS 7 109 9113600
193405673 levinezhou A Feb. 12, 2023, 10:55 p.m. OK PyPy 3-64 TESTS 7 124 9113600
193403940 RobinFromTheHood A Feb. 12, 2023, 10:17 p.m. OK PyPy 3-64 TESTS 7 124 9216000
193403900 RobinFromTheHood A Feb. 12, 2023, 10:16 p.m. OK PyPy 3-64 TESTS 7 124 9216000
193367067 cros107 A Feb. 12, 2023, 3:49 p.m. OK PyPy 3-64 TESTS 7 124 9216000
193415008 generalPurpose A Feb. 13, 2023, 3:10 a.m. OK PyPy 3-64 TESTS 7 124 9318400
193370442 Aravind A Feb. 12, 2023, 4:20 p.m. OK PyPy 3-64 TESTS 7 139 8908800
193343774 rmr A Feb. 12, 2023, 12:29 p.m. OK PyPy 3-64 TESTS 7 139 9216000
193418985 ernur_077 A Feb. 13, 2023, 4:40 a.m. OK Python 3 TESTS 7 77 204800
193354565 Ysb04 A Feb. 12, 2023, 2:01 p.m. OK Python 3 TESTS 7 78 307200
193339206 nik_enjoy A Feb. 12, 2023, 11:47 a.m. OK Python 3 TESTS 7 93 204800
193369581 kanishq_prasad A Feb. 12, 2023, 4:13 p.m. OK Python 3 TESTS 7 109 204800
193395279 codeforcesHQ A Feb. 12, 2023, 8:06 p.m. OK Python 3 TESTS 7 155 0
193388908 karo123456789 A Feb. 12, 2023, 6:58 p.m. OK Python 3 TESTS 7 155 0
193381357 Great_Druk A Feb. 12, 2023, 5:50 p.m. OK Python 3 TESTS 7 155 0
193376689 R_PRANAV_GUHAN A Feb. 12, 2023, 5:11 p.m. OK Python 3 TESTS 7 155 0
193375928 axel.gronland A Feb. 12, 2023, 5:05 p.m. OK Python 3 TESTS 7 155 0
193343370 infinitix A Feb. 12, 2023, 12:25 p.m. OK Python 3 TESTS 7 155 0
193341930 memoryallocator A Feb. 12, 2023, 12:11 p.m. OK Rust 2021 TESTS 7 93 1024000

remove filters

Back to search problems