Codeforces Global Round 19

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
1637 Codeforces Global Round 19 FINISHED False 9000 92589863 Feb. 12, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3430 ) E Best Pair PROGRAMMING binary search brute force

B"You are given an array a of length n . Let cnt_x be the number of elements from the array which are equal to x . Let's also define f(x, y) as (cnt_x + cnt_y) cdot (x + y) . Also you are given m bad pairs (x_i, y_i) . Note that if (x, y) is a bad pair, then (y, x) is also bad. Your task is to find the maximum value of f(u, v) over all pairs (u, v) , such that u neq v , that this pair is not bad, and also that u and v each occur in the array a . It is guaranteed that such a pair exists. The first line contains a single integer t ( 1 <= t <= 10 ,000 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 2 <= n <= 3 cdot 10^5 , 0 <= m <= 3 cdot 10^5 ) -- the length of the array and the number of bad pairs. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ) -- elements of the array. The i -th of the next m lines contains two integers x_i and y_i ( 1 <= x_i < y_i <= 10^9 ), which represent a bad pair. It is guaranteed that no bad pair occurs twice in the input. It is also guaranteed that cnt_{x_i} > 0 and cnt_{y_i} > 0 . It is guaranteed that for each test case there is a pair of integers (u, v) , u ne v , that is not bad, and such that both of these numbers occur in a . It is guaranteed that the total sum of n and the total sum of m don't exceed 3 cdot 10^5 . For each test case print a single integer -- the answer to the problem. In the first test case 3 , 6 , 7 occur in the array. The answer to the problem is max(40, 39) = 40 . "...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
146160521 Gassa E Feb. 12, 2022, 6:21 p.m. OK D TESTS 73 717 83865600
146158991 hos.lyric E Feb. 12, 2022, 6:09 p.m. OK D TESTS 73 826 55193600
146163057 yao11617 E Feb. 12, 2022, 6:43 p.m. OK GNU C++14 TESTS 73 374 14745600
146182863 Logic_zys E Feb. 13, 2022, 12:59 a.m. OK GNU C++14 TESTS 77 389 61849600
146196293 tanuki E Feb. 13, 2022, 5:30 a.m. OK GNU C++14 TESTS 78 467 25395200
146157602 usernameson E Feb. 12, 2022, 6:02 p.m. OK GNU C++14 TESTS 73 468 22118400
146166869 sare E Feb. 12, 2022, 7:26 p.m. OK GNU C++14 TESTS 74 483 20275200
146168716 Kal-El E Feb. 12, 2022, 7:49 p.m. OK GNU C++14 TESTS 75 530 19968000
146184547 grass8cow E Feb. 13, 2022, 1:45 a.m. OK GNU C++14 TESTS 77 545 24780800
146187752 DeerInForestovo E Feb. 13, 2022, 3:04 a.m. OK GNU C++14 TESTS 78 607 20787200
146184169 moonrise__ E Feb. 13, 2022, 1:35 a.m. OK GNU C++14 TESTS 77 624 31744000
146157740 forest E Feb. 12, 2022, 6:03 p.m. OK GNU C++14 TESTS 73 639 28057600
146193777 onteeae E Feb. 13, 2022, 4:55 a.m. OK GNU C++17 TESTS 78 373 44032000
146196330 Love_Youuu E Feb. 13, 2022, 5:30 a.m. OK GNU C++17 TESTS 78 420 22016000
146174159 lxyb E Feb. 12, 2022, 9:13 p.m. OK GNU C++17 TESTS 76 421 18534400
146171237 riadwaw E Feb. 12, 2022, 8:25 p.m. OK GNU C++17 TESTS 75 452 16179200
146188738 DeaL57 E Feb. 13, 2022, 3:26 a.m. OK GNU C++17 TESTS 78 468 23142400
146184628 Mryange E Feb. 13, 2022, 1:47 a.m. OK GNU C++17 TESTS 77 468 23142400
146180055 zzlltt E Feb. 12, 2022, 11:35 p.m. OK GNU C++17 TESTS 77 468 23142400
146179326 Solstice E Feb. 12, 2022, 11:13 p.m. OK GNU C++17 TESTS 77 499 16076800
146189408 TrivialMan E Feb. 13, 2022, 3:39 a.m. OK GNU C++17 TESTS 78 545 19558400
146180038 Solstice E Feb. 12, 2022, 11:35 p.m. OK GNU C++17 TESTS 77 561 16076800
146178893 maxplus E Feb. 12, 2022, 11:01 p.m. OK GNU C++17 (64) TESTS 77 62 16179200
146159683 LayCurse E Feb. 12, 2022, 6:14 p.m. OK GNU C++17 (64) TESTS 73 109 122572800
146197860 iceylemon157 E Feb. 13, 2022, 5:48 a.m. OK GNU C++17 (64) TESTS 78 451 32051200
146174567 BigBag E Feb. 12, 2022, 9:20 p.m. OK GNU C++17 (64) TESTS 76 452 22425600
146185858 lightseba E Feb. 13, 2022, 2:18 a.m. OK GNU C++17 (64) TESTS 78 498 59494400
146167970 kevinyang E Feb. 12, 2022, 7:40 p.m. OK GNU C++17 (64) TESTS 75 514 44953600
146185881 lightseba E Feb. 13, 2022, 2:18 a.m. OK GNU C++17 (64) TESTS 78 530 59494400
146185832 lightseba E Feb. 13, 2022, 2:18 a.m. OK GNU C++17 (64) TESTS 78 530 59494400
146185930 lightseba E Feb. 13, 2022, 2:20 a.m. OK GNU C++17 (64) TESTS 78 545 59494400
146159127 maxplus E Feb. 12, 2022, 6:10 p.m. OK GNU C++17 (64) TESTS 73 560 49971200
146179053 maxplus E Feb. 12, 2022, 11:05 p.m. OK GNU C++20 (64) TESTS 77 62 16179200
146178777 maxplus E Feb. 12, 2022, 10:58 p.m. OK GNU C++20 (64) TESTS 77 62 16179200
146178754 maxplus E Feb. 12, 2022, 10:58 p.m. OK GNU C++20 (64) TESTS 77 77 16179200
146177477 maxplus E Feb. 12, 2022, 10:23 p.m. OK GNU C++20 (64) TESTS 77 77 16179200
146179310 maxplus E Feb. 12, 2022, 11:13 p.m. OK GNU C++20 (64) TESTS 77 78 16179200
146179104 maxplus E Feb. 12, 2022, 11:07 p.m. OK GNU C++20 (64) TESTS 77 78 16179200
146179027 maxplus E Feb. 12, 2022, 11:05 p.m. OK GNU C++20 (64) TESTS 77 78 16179200
146177406 maxplus E Feb. 12, 2022, 10:21 p.m. OK GNU C++20 (64) TESTS 77 78 16179200
146177237 maxplus E Feb. 12, 2022, 10:17 p.m. OK GNU C++20 (64) TESTS 77 78 16179200
146177053 maxplus E Feb. 12, 2022, 10:12 p.m. OK GNU C++20 (64) TESTS 77 78 17612800
146160627 clyring E Feb. 12, 2022, 6:21 p.m. OK Haskell TESTS 73 1855 121856000
146150653 eatmore E Feb. 12, 2022, 4:58 p.m. OK Java 11 TESTS 73 670 42803200
146178901 dzhi E Feb. 12, 2022, 11:01 p.m. OK Java 11 TESTS 77 1341 54067200
146170782 mwen E Feb. 12, 2022, 8:18 p.m. OK Java 11 TESTS 75 1481 69120000
146159792 shojin_pro E Feb. 12, 2022, 6:15 p.m. OK Java 11 TESTS 73 1497 73728000
146160764 saptarshi1729 E Feb. 12, 2022, 6:22 p.m. OK Java 11 TESTS 73 1793 148070400
146170602 Dukkha E Feb. 12, 2022, 8:15 p.m. OK Java 11 TESTS 75 1965 83558400
146158877 MagentaCobra E Feb. 12, 2022, 6:09 p.m. OK Java 8 TESTS 73 1091 60620800
146152504 YahiaSherif E Feb. 12, 2022, 5:02 p.m. OK Java 8 TESTS 73 1435 81920000
146177732 r57shell E Feb. 12, 2022, 10:29 p.m. OK MS C++ 2017 TESTS 77 514 13516800
146171284 r57shell E Feb. 12, 2022, 8:25 p.m. OK MS C++ 2017 TESTS 75 561 13516800
146153808 Rudovich E Feb. 12, 2022, 5:04 p.m. OK MS C++ 2017 TESTS 73 1341 32870400
146177650 grey E Feb. 12, 2022, 10:28 p.m. OK MS C++ 2017 TESTS 77 1497 100659200
146178424 hxu10 E Feb. 12, 2022, 10:47 p.m. OK PyPy 2 TESTS 77 670 52940800
146167389 OLOGY E Feb. 12, 2022, 7:33 p.m. OK PyPy 2 TESTS 74 686 75776000
146165875 OLOGY E Feb. 12, 2022, 7:15 p.m. OK PyPy 2 TESTS 74 701 69222400
146177162 OLOGY E Feb. 12, 2022, 10:15 p.m. OK PyPy 2 TESTS 77 763 69427200
146164537 OLOGY E Feb. 12, 2022, 6:58 p.m. OK PyPy 2 TESTS 73 1060 69734400
146177051 OLOGY E Feb. 12, 2022, 10:12 p.m. OK PyPy 2 TESTS 77 1091 76083200
146178404 hxu10 E Feb. 12, 2022, 10:47 p.m. OK PyPy 3 TESTS 77 655 54784000
146173921 jano31415 E Feb. 12, 2022, 9:09 p.m. OK PyPy 3 TESTS 76 1200 53145600
146164614 codicon E Feb. 12, 2022, 6:59 p.m. OK PyPy 3 TESTS 73 1340 54374400
146195052 Apoorv_Rathore E Feb. 13, 2022, 5:13 a.m. OK PyPy 3 TESTS 78 1435 113459200
146167209 titia E Feb. 12, 2022, 7:30 p.m. OK PyPy 3 TESTS 74 1684 63795200
146164376 eepsilon E Feb. 12, 2022, 6:57 p.m. OK PyPy 3 TESTS 73 1684 69427200
146178392 hxu10 E Feb. 12, 2022, 10:47 p.m. OK PyPy 3-64 TESTS 77 638 84377600
146165387 OLOGY E Feb. 12, 2022, 7:09 p.m. OK PyPy 3-64 TESTS 73 966 98611200
146159454 kclee2172 E Feb. 12, 2022, 6:12 p.m. OK PyPy 3-64 TESTS 73 1591 205619200
146182570 yupooh E Feb. 13, 2022, 12:51 a.m. OK PyPy 3-64 TESTS 77 1606 95948800
146159571 kclee2172 E Feb. 12, 2022, 6:13 p.m. OK PyPy 3-64 TESTS 73 1684 202854400
146159509 kclee2172 E Feb. 12, 2022, 6:13 p.m. OK PyPy 3-64 TESTS 73 1684 205107200
146166538 Hdk2127 E Feb. 12, 2022, 7:22 p.m. OK PyPy 3-64 TESTS 74 1731 93388800
146169923 huikang E Feb. 12, 2022, 8:05 p.m. OK PyPy 3-64 TESTS 75 1872 183296000
146169836 huikang E Feb. 12, 2022, 8:04 p.m. OK PyPy 3-64 TESTS 75 1903 181350400
146177151 OLOGY E Feb. 12, 2022, 10:14 p.m. OK Python 2 TESTS 77 1310 73113600
146177077 OLOGY E Feb. 12, 2022, 10:12 p.m. OK Python 2 TESTS 77 1356 73113600
146180982 r57shell E Feb. 13, 2022, 12:05 a.m. OK Python 3 TESTS 77 1309 35225600
146191697 cottoncotton E Feb. 13, 2022, 4:21 a.m. OK Rust 2021 TESTS 78 155 84070400
146188136 clause E Feb. 13, 2022, 3:13 a.m. OK Rust 2021 TESTS 78 654 32870400
146158825 46hinat E Feb. 12, 2022, 6:08 p.m. OK Rust 2021 TESTS 73 1279 74035200

remove filters

Back to search problems