Codeforces Round 1043 (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
2132 Codeforces Round 1043 (Div. 3) FINISHED False 8100 20618723 Aug. 21, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 7533 ) E Arithmetics Competition PROGRAMMING binary search data structures greedy ternary search

In the arithmetic competition, participants need to achieve the highest possible sum from the cards they have. In the team "fst_ezik" , Vadim has (n) cards with numbers (a_i), and Kostya has (m) cards with numbers (b_i). In each of the (q) rounds, they want to win, but this time the rules of the competition are slightly different from the usual ones. In each round, the participants are given three numbers (x_i), (y_i), and (z_i). The team "fst_ezik" must choose exactly (z_i) cards from all the cards they have, but Vadim can choose no more than (x_i) cards from his set, and Kostya can choose no more than (y_i) cards from his set. Help them find the highest possible sum for each of the (q) rounds. Each test consists of several test cases. The first line contains a single integer (t) ((1 \le t \le 10^4)) — the number of test cases. The descriptions of the test cases follow. In the first line of each test case, three integers (n), (m), (q) are given ((1 \le n, m \le 2 \cdot 10^5, 1 \le q \le 10^5)) — the number of cards Vadim has, the number of cards Kostya has, and the number of rounds in the competition. The second line contains (n) integers (a_i) — the numbers on Vadim's cards ((1 \le a_i \le 10^9)). The third line contains (m) integers (b_i) — the numbers on Kostya's cards ((1 \le b_i \le 10^9)). The following (q) lines describe the rounds with three integers (x_i), (y_i), (z_i) ((0 \le x_i \le n, 0 \le y_i \le m, 0 \le z_i \le x_i + y_i)) — the limit on the number of cards Vadim can choose, the limit on the number of cards Kostya can choose, and the number of cards they need to select together. It is guaranteed that the sum of (n) across all test cases does not exceed (2 \cdot 10^5), the sum of (m) across all test cases does not exceed (2 \cdot 10^5), and the sum of (q) across all test cases does not exceed (10^5). Fo

Tutorials

Codeforces Round 1043 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
335116853 og.kostya E Aug. 23, 2025, 6:09 a.m. OK C# 13 TESTS 12 359 16486400
335054019 ZcDawn E Aug. 22, 2025, 3:14 p.m. OK C++17 (GCC 7-32) TESTS 12 234 4198400
335047074 xuemanowo E Aug. 22, 2025, 2:22 p.m. OK C++17 (GCC 7-32) TESTS 12 249 4812800
335059633 leducchinh E Aug. 22, 2025, 3:58 p.m. OK C++17 (GCC 7-32) TESTS 12 249 5632000
335180963 AccPhuCuaTungLam E Aug. 23, 2025, 2:32 p.m. OK C++17 (GCC 7-32) TESTS 12 249 8089600
335113366 algoridam61 E Aug. 23, 2025, 5:33 a.m. OK C++17 (GCC 7-32) TESTS 12 249 9011200
335078679 Garendaxe E Aug. 22, 2025, 6:42 p.m. OK C++17 (GCC 7-32) TESTS 12 249 10444800
335025691 Laviet E Aug. 22, 2025, 11:35 a.m. OK C++17 (GCC 7-32) TESTS 12 250 4198400
335026393 Sagnik_2004 E Aug. 22, 2025, 11:41 a.m. OK C++17 (GCC 7-32) TESTS 12 264 2560000
335237525 _CENSORED E Aug. 24, 2025, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 12 264 4096000
335079372 bondsmith E Aug. 22, 2025, 6:49 p.m. OK C++17 (GCC 7-32) TESTS 12 264 9011200
335029130 uuku E Aug. 22, 2025, 12:05 p.m. OK C++20 (GCC 13-64) TESTS 12 108 13312000
335078111 Mariom E Aug. 22, 2025, 6:35 p.m. OK C++20 (GCC 13-64) TESTS 12 171 8908800
335076821 Hadad17 E Aug. 22, 2025, 6:22 p.m. OK C++20 (GCC 13-64) TESTS 12 186 2560000
335113257 RainbowDash. E Aug. 23, 2025, 5:32 a.m. OK C++20 (GCC 13-64) TESTS 12 186 12185600
335024328 AyachiNeneshjl E Aug. 22, 2025, 11:22 a.m. OK C++20 (GCC 13-64) TESTS 12 186 14028800
335100744 Md_Minhaj E Aug. 23, 2025, 2:10 a.m. OK C++20 (GCC 13-64) TESTS 12 187 0
335195411 askmecode2003 E Aug. 23, 2025, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 12 187 2560000
335114889 UItace E Aug. 23, 2025, 5:49 a.m. OK C++20 (GCC 13-64) TESTS 12 187 2560000
335034910 arodnap33 E Aug. 22, 2025, 12:54 p.m. OK C++20 (GCC 13-64) TESTS 12 187 3788800
335098097 zime_www E Aug. 23, 2025, 1:02 a.m. OK C++20 (GCC 13-64) TESTS 12 187 4198400
335038445 xzc426_0vo E Aug. 22, 2025, 1:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 2662400
335112088 CoderACPPradyuman E Aug. 23, 2025, 5:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 186 2662400
335034333 blazeofdu E Aug. 22, 2025, 12:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 0
335224752 SoumyadeepTus12345 E Aug. 23, 2025, 9:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 1126400
335235601 JMaa32 E Aug. 24, 2025, 3:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 2662400
335178515 Bhuban E Aug. 23, 2025, 2:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 2662400
335143338 adithyahegdek E Aug. 23, 2025, 9:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 2662400
335078699 HoneyGupta E Aug. 22, 2025, 6:42 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 2662400
335100384 Jomify E Aug. 23, 2025, 2:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 4300800
335258231 pepperly E Aug. 24, 2025, 6:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 187 5836800
335116452 KL2400031478 E Aug. 23, 2025, 6:05 a.m. OK GNU C11 TESTS 12 312 11264000
335019542 spyde40 E Aug. 22, 2025, 10:35 a.m. OK Java 21 TESTS 12 312 5222400
335226558 UdayRajVadeghar E Aug. 23, 2025, 10:27 p.m. OK Java 21 TESTS 12 499 8396800
335175112 InfinityX E Aug. 23, 2025, 1:48 p.m. OK Java 21 TESTS 12 624 10444800
335199212 Balu2907 E Aug. 23, 2025, 5:05 p.m. OK Java 21 TESTS 12 811 32153600
335197719 Soumarya_Pal E Aug. 23, 2025, 4:54 p.m. OK Java 21 TESTS 12 812 9113600
335058508 KRRISH9977 E Aug. 22, 2025, 3:51 p.m. OK Java 21 TESTS 12 999 53760000
335116978 roushanritik062 E Aug. 23, 2025, 6:11 a.m. OK Java 21 TESTS 12 1077 53248000
335027514 hemanth_reddyy12 E Aug. 22, 2025, 11:52 a.m. OK Java 21 TESTS 12 1640 16793600
335025326 ironman263 E Aug. 22, 2025, 11:31 a.m. OK Java 21 TESTS 12 1687 32051200
335038424 NooB__C0der E Aug. 22, 2025, 1:21 p.m. OK Java 21 TESTS 12 1765 14745600
335020590 Ashutosh_1030 E Aug. 22, 2025, 10:45 a.m. OK Java 8 TESTS 12 405 22937600
335124995 Michael_One2 E Aug. 23, 2025, 7:24 a.m. OK Java 8 TESTS 12 406 19558400
335063149 testtest111ksjfrdvn E Aug. 22, 2025, 4:25 p.m. OK Java 8 TESTS 12 765 45772800
335194109 divya8080 E Aug. 23, 2025, 4:23 p.m. OK Java 8 TESTS 12 812 78233600
335068202 testtest111ksjfrdvn E Aug. 22, 2025, 5:08 p.m. OK Java 8 TESTS 12 984 115404800
335091227 Lyamzin_alexandr E Aug. 22, 2025, 9:37 p.m. OK Kotlin 2.2 TESTS 12 1327 44236800
335236571 chinesedfan E Aug. 24, 2025, 3:49 a.m. OK Node.js TESTS 12 1218 93491200
335219823 yin_yin81 E Aug. 23, 2025, 8:15 p.m. OK PyPy 3 TESTS 12 1921 43622400
335086322 iN_siDious E Aug. 22, 2025, 8:15 p.m. OK PyPy 3-64 TESTS 12 374 48844800
335152034 Avneesh107 E Aug. 23, 2025, 10:50 a.m. OK PyPy 3-64 TESTS 12 390 39526400
335188468 minuki646 E Aug. 23, 2025, 3:35 p.m. OK PyPy 3-64 TESTS 12 405 40140800
335098960 Baichuan E Aug. 23, 2025, 1:25 a.m. OK PyPy 3-64 TESTS 12 452 41164800
335018474 Om_Singh_ E Aug. 22, 2025, 10:23 a.m. OK PyPy 3-64 TESTS 12 467 35942400
335021506 DeadMan69 E Aug. 22, 2025, 10:54 a.m. OK PyPy 3-64 TESTS 12 483 52428800
335076153 x3mka E Aug. 22, 2025, 6:17 p.m. OK PyPy 3-64 TESTS 12 530 45977600
335237604 naveents1915 E Aug. 24, 2025, 3:58 a.m. OK PyPy 3-64 TESTS 12 593 72294400
335032849 kelvinp E Aug. 22, 2025, 12:36 p.m. OK PyPy 3-64 TESTS 12 671 34918400
335084499 bigdamdam E Aug. 22, 2025, 7:50 p.m. OK PyPy 3-64 TESTS 12 671 35225600
335029875 QuadD4rv1n7 E Aug. 22, 2025, 12:11 p.m. OK Python 3 TESTS 12 749 84070400
335223654 basicstuff2308 E Aug. 23, 2025, 9:18 p.m. OK Python 3 TESTS 12 1046 75571200
335049139 Rcrocks E Aug. 22, 2025, 2:37 p.m. OK Python 3 TESTS 12 1484 105779200
335058606 anshul_7126 E Aug. 22, 2025, 3:51 p.m. OK Python 3 TESTS 12 2311 44032000
335045880 Rcrocks E Aug. 22, 2025, 2:13 p.m. OK Python 3 TESTS 12 2983 50892800
335184970 bqn E Aug. 23, 2025, 3:05 p.m. OK Rust 2021 TESTS 12 358 40652800
335032783 pohzipohzi E Aug. 22, 2025, 12:36 p.m. OK Rust 2024 TESTS 12 93 7680000

remove filters

Back to search problems