Codeforces Global Round 22

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
1738 Codeforces Global Round 22 FINISHED False 9000 67274699 Sept. 30, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13559 ) A Glory Addicts PROGRAMMING greedy implementation

B'The hero is addicted to glory, and is fighting against a monster. The hero has n skills. The i -th skill is of type a_i (either fire or frost) and has initial damage b_i . The hero can perform all of the n skills in any order (with each skill performed exactly once). When performing each skill, the hero can play a magic as follows: Your task is to find the maximum damage the hero can deal. Each test contains multiple test cases. The first line contains an integer t ( 1 <= q t <= q 10^5 ) -- the number of test cases. The following lines contain the description of each test case. The first line of each test case contains an integer n ( 1 <= q n <= q 10^5 ), indicating the number of skills. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 0 <= q a_i <= q 1 ), where a_i indicates the type of the i -th skill. Specifically, the i -th skill is of type fire if a_i = 0 , and of type frost if a_i = 1 . The third line of each test case contains n integers b_1, b_2, ... , b_n ( 1 <= q b_i <= q 10^9 ), where b_i indicates the initial damage of the i -th skill. It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, output the maximum damage the hero can deal. In the first test case, we can order the skills by [3, 1, 4, 2] , and the total damage is 100 + 2 x 1 + 2 x 1000 + 10 = 2112 . In the second test case, we can order the skills by [1, 4, 2, 5, 3, 6] , and the total damage is 3 + 2 x 6 + 2 x 4 + 2 x 7 + 2 x 5 + 2 x 8 = 63 . In the third test case, we can order the skills by [1, 2, 3] , and the total damage is 1000000000 + 1000000000 + 1000000000 = 3000000000 . In the fourth test case, there is only one skill with initial damage 1 , so the total damage is 1 . '...

Tutorials

Editorial of Codeforces Global Round <strong>22</strong>

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
174152493 yuliva2 A Sept. 30, 2022, 4:57 p.m. OK C# 10 TESTS 27 623 17715200
174169685 JK_K A Sept. 30, 2022, 7:17 p.m. OK Clang++17 Diagnostics TESTS 27 171 1433600
174163435 sufi_16 A Sept. 30, 2022, 6:24 p.m. OK GNU C++14 TESTS 27 62 2048000
174186237 sginuni A Oct. 1, 2022, 1 a.m. OK GNU C++14 TESTS 27 77 1536000
174206232 PAN23 A Oct. 1, 2022, 6:02 a.m. OK GNU C++14 TESTS 27 77 1945600
174187937 GuAn666 A Oct. 1, 2022, 1:36 a.m. OK GNU C++14 TESTS 27 77 1945600
174166786 rakinrkz A Sept. 30, 2022, 6:49 p.m. OK GNU C++14 TESTS 27 77 1945600
174186294 jyttoby A Oct. 1, 2022, 1:01 a.m. OK GNU C++14 TESTS 27 77 3174400
174181565 CYhuang A Sept. 30, 2022, 10:40 p.m. OK GNU C++14 TESTS 27 77 3584000
174185586 guoxinyugz A Oct. 1, 2022, 12:45 a.m. OK GNU C++14 TESTS 27 78 819200
174186767 jyt0217 A Oct. 1, 2022, 1:11 a.m. OK GNU C++14 TESTS 27 78 1228800
174198945 Gordon_Z A Oct. 1, 2022, 4:37 a.m. OK GNU C++14 TESTS 27 78 1536000
174180151 abdallah_moemen A Sept. 30, 2022, 10:03 p.m. OK GNU C++17 TESTS 27 77 1536000
174189987 chute A Oct. 1, 2022, 2:14 a.m. OK GNU C++17 TESTS 27 77 1945600
174187762 nianheng233 A Oct. 1, 2022, 1:32 a.m. OK GNU C++17 TESTS 27 77 1945600
174202877 Intercept A Oct. 1, 2022, 5:27 a.m. OK GNU C++17 TESTS 27 77 2048000
174163454 shihapfdim A Sept. 30, 2022, 6:24 p.m. OK GNU C++17 TESTS 27 77 2457600
174179285 antilopine A Sept. 30, 2022, 9:46 p.m. OK GNU C++17 TESTS 27 77 2764800
174170493 trying_n_trying A Sept. 30, 2022, 7:27 p.m. OK GNU C++17 TESTS 27 77 3584000
174165455 zimno A Sept. 30, 2022, 6:38 p.m. OK GNU C++17 TESTS 27 77 3584000
174162704 vijay262 A Sept. 30, 2022, 6:20 p.m. OK GNU C++17 TESTS 27 77 3584000
174201568 knatwila A Oct. 1, 2022, 5:11 a.m. OK GNU C++17 TESTS 27 77 5222400
174193934 Freedom__King A Oct. 1, 2022, 3:21 a.m. OK GNU C++17 (64) TESTS 27 31 12595200
174173074 Krzychuo A Sept. 30, 2022, 8 p.m. OK GNU C++17 (64) TESTS 27 46 2662400
174190655 FangYifan A Oct. 1, 2022, 2:25 a.m. OK GNU C++17 (64) TESTS 27 61 3481600
174186603 AntiArtAttachment A Oct. 1, 2022, 1:08 a.m. OK GNU C++17 (64) TESTS 27 61 3993600
174199780 Lunasama A Oct. 1, 2022, 4:48 a.m. OK GNU C++17 (64) TESTS 27 62 1433600
174152673 DarkGodWind A Sept. 30, 2022, 4:58 p.m. OK GNU C++17 (64) TESTS 27 62 1638400
174178744 PurpleCrayon A Sept. 30, 2022, 9:34 p.m. OK GNU C++17 (64) TESTS 27 62 1843200
174168809 znhy A Sept. 30, 2022, 7:08 p.m. OK GNU C++17 (64) TESTS 27 62 1843200
174167962 znhy A Sept. 30, 2022, 7 p.m. OK GNU C++17 (64) TESTS 27 62 1843200
174148989 luanpinheiro A Sept. 30, 2022, 4:48 p.m. OK GNU C++17 (64) TESTS 27 62 2048000
174162520 The_mercenary A Sept. 30, 2022, 6:19 p.m. OK GNU C++20 (64) TESTS 27 46 819200
174164794 Deep__Blue A Sept. 30, 2022, 6:33 p.m. OK GNU C++20 (64) TESTS 27 46 1024000
174173618 Dabhi_Dipak A Sept. 30, 2022, 8:07 p.m. OK GNU C++20 (64) TESTS 27 46 1228800
174153455 Daybreak7 A Sept. 30, 2022, 4:59 p.m. OK GNU C++20 (64) TESTS 27 46 1228800
174204313 QwQcOrZ A Oct. 1, 2022, 5:43 a.m. OK GNU C++20 (64) TESTS 27 46 1433600
174189522 GoldLight A Oct. 1, 2022, 2:05 a.m. OK GNU C++20 (64) TESTS 27 46 1433600
174182052 LLGM A Sept. 30, 2022, 10:54 p.m. OK GNU C++20 (64) TESTS 27 46 1433600
174169010 ishwarendra A Sept. 30, 2022, 7:10 p.m. OK GNU C++20 (64) TESTS 27 46 1433600
174166657 AliRagab313 A Sept. 30, 2022, 6:48 p.m. OK GNU C++20 (64) TESTS 27 46 1433600
174195319 Sparsh-123 A Oct. 1, 2022, 3:44 a.m. OK GNU C++20 (64) TESTS 27 46 1638400
174197790 rajneesh.osho A Oct. 1, 2022, 4:22 a.m. OK Java 11 TESTS 27 202 0
174193512 Yousef_Badr A Oct. 1, 2022, 3:15 a.m. OK Java 11 TESTS 27 234 0
174183190 hashedBA6 A Sept. 30, 2022, 11:40 p.m. OK Java 11 TESTS 27 249 307200
174164634 eshan18.09 A Sept. 30, 2022, 6:32 p.m. OK Java 11 TESTS 27 280 614400
174169761 uros A Sept. 30, 2022, 7:18 p.m. OK Java 11 TESTS 27 889 819200
174162135 g_square A Sept. 30, 2022, 6:17 p.m. OK Java 11 TESTS 27 889 1228800
174161984 SAY_NO_TO_EDITORIAL A Sept. 30, 2022, 6:16 p.m. OK Java 11 TESTS 27 889 1228800
174174758 AyushS_cg170 A Sept. 30, 2022, 8:25 p.m. OK Java 11 TESTS 27 904 6963200
174150100 idkomarov A Sept. 30, 2022, 4:51 p.m. OK Java 11 TESTS 27 1653 18124800
174193436 Yousef_Badr A Oct. 1, 2022, 3:13 a.m. OK Java 17 TESTS 27 342 1433600
174174335 freehandle A Sept. 30, 2022, 8:18 p.m. OK Java 17 TESTS 27 342 1740800
174173564 alexis779 A Sept. 30, 2022, 8:06 p.m. OK Java 17 TESTS 27 499 15052800
174197411 kushireddy A Oct. 1, 2022, 4:16 a.m. OK Java 17 TESTS 27 888 1536000
174195057 Abhishek_821023 A Oct. 1, 2022, 3:39 a.m. OK Java 17 TESTS 27 888 1536000
174170680 Vas1l1y A Sept. 30, 2022, 7:29 p.m. OK Java 17 TESTS 27 889 1740800
174182182 dusty.and.rusty A Sept. 30, 2022, 10:57 p.m. OK Java 17 TESTS 27 951 5734400
174195451 Sussykin A Oct. 1, 2022, 3:46 a.m. OK Java 8 TESTS 27 155 0
174195206 priyaroy3370 A Oct. 1, 2022, 3:42 a.m. OK Java 8 TESTS 27 155 1536000
174190946 amit_roy A Oct. 1, 2022, 2:30 a.m. OK Java 8 TESTS 27 155 1536000
174192255 fahad00cms A Oct. 1, 2022, 2:53 a.m. OK Java 8 TESTS 27 156 0
174167249 TheMasterOfSuspense A Sept. 30, 2022, 6:53 p.m. OK Java 8 TESTS 27 171 716800
174163515 P1011 A Sept. 30, 2022, 6:24 p.m. OK Java 8 TESTS 27 171 2252800
174171807 mohamedhassan_c A Sept. 30, 2022, 7:43 p.m. OK Java 8 TESTS 27 187 2355200
174171231 rameznashaat9999 A Sept. 30, 2022, 7:35 p.m. OK Java 8 TESTS 27 202 409600
174165344 Youssef1Shawky A Sept. 30, 2022, 6:37 p.m. OK Java 8 TESTS 27 202 2662400
174171404 rameznashaat9999 A Sept. 30, 2022, 7:37 p.m. OK Java 8 TESTS 27 218 716800
174162749 arvindf232 A Sept. 30, 2022, 6:20 p.m. OK Kotlin 1.6 TESTS 27 249 1433600
174196195 ripity A Oct. 1, 2022, 3:58 a.m. OK Kotlin 1.6 TESTS 27 295 2662400
174154992 Bloodwyn A Sept. 30, 2022, 5:03 p.m. OK Kotlin 1.6 TESTS 27 982 6451200
174153499 lzbcry A Sept. 30, 2022, 5 p.m. OK MS C++ 2017 TESTS 27 577 3174400
174166436 oneku A Sept. 30, 2022, 6:46 p.m. OK PyPy 3 TESTS 27 499 12185600
174148799 dagmat A Sept. 30, 2022, 4:47 p.m. OK PyPy 3 TESTS 27 530 11673600
174165749 oneku A Sept. 30, 2022, 6:40 p.m. OK PyPy 3 TESTS 27 530 12390400
174165109 tan_delhi A Sept. 30, 2022, 6:35 p.m. OK PyPy 3 TESTS 27 530 19046400
174175126 matans844 A Sept. 30, 2022, 8:31 p.m. OK PyPy 3 TESTS 27 732 16793600
174153802 Wind5654 A Sept. 30, 2022, 5 p.m. OK PyPy 3 TESTS 27 763 14540800
174178573 crapcode A Sept. 30, 2022, 9:31 p.m. OK PyPy 3-64 TESTS 27 187 20377600
174186833 bridgekiller A Oct. 1, 2022, 1:13 a.m. OK PyPy 3-64 TESTS 27 233 18329600
174188114 hkwu6013 A Oct. 1, 2022, 1:39 a.m. OK PyPy 3-64 TESTS 27 233 22528000
174164155 sagarpal1909 A Sept. 30, 2022, 6:28 p.m. OK PyPy 3-64 TESTS 27 264 17305600
174162255 kavorka A Sept. 30, 2022, 6:18 p.m. OK PyPy 3-64 TESTS 27 280 19865600
174147462 govindp47 A Sept. 30, 2022, 4:43 p.m. OK PyPy 3-64 TESTS 27 296 17510400
174152833 Uzdik A Sept. 30, 2022, 4:58 p.m. OK PyPy 3-64 TESTS 27 311 19251200
174163705 iron_nicko A Sept. 30, 2022, 6:25 p.m. OK PyPy 3-64 TESTS 27 311 19456000
174170878 Varad2002 A Sept. 30, 2022, 7:31 p.m. OK PyPy 3-64 TESTS 27 312 16998400
174193089 BigWhiteRabbit A Oct. 1, 2022, 3:07 a.m. OK PyPy 3-64 TESTS 27 343 18124800
174160799 akshat11 A Sept. 30, 2022, 6:10 p.m. OK Python 3 TESTS 27 685 8908800
174178696 Eversun A Sept. 30, 2022, 9:34 p.m. OK Python 3 TESTS 27 842 12902400
174168814 fuyj15 A Sept. 30, 2022, 7:08 p.m. OK Python 3 TESTS 27 842 12902400
174163661 iron_nicko A Sept. 30, 2022, 6:25 p.m. OK Python 3 TESTS 27 919 9318400
174181741 Ray_29 A Sept. 30, 2022, 10:45 p.m. OK Python 3 TESTS 27 1091 8601600
174161409 eugalt A Sept. 30, 2022, 6:13 p.m. OK Python 3 TESTS 27 1201 7884800
174166680 WenqingWenqing A Sept. 30, 2022, 6:48 p.m. OK Python 3 TESTS 27 1201 8396800
174163968 eugalt A Sept. 30, 2022, 6:27 p.m. OK Python 3 TESTS 27 1279 7577600
174165030 eugalt A Sept. 30, 2022, 6:34 p.m. OK Python 3 TESTS 27 1294 7884800
174151376 driplord A Sept. 30, 2022, 4:54 p.m. OK Python 3 TESTS 27 1294 8192000
174187808 Spheniscine A Oct. 1, 2022, 1:33 a.m. OK Rust 2021 TESTS 27 46 3891200

remove filters

Back to search problems