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 100106687 Feb. 12, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8087 ) D Yet Another Minimization Problem PROGRAMMING dp math

B"You are given two arrays a and b , both of length n . You can perform the following operation any number of times (possibly zero): select an index i ( 1 <= q i <= q n ) and swap a_i and b_i . Let's define the cost of the array a as sum_{i=1}^{n} sum_{j=i + 1}^{n} (a_i + a_j)^2 . Similarly, the cost of the array b is sum_{i=1}^{n} sum_{j=i + 1}^{n} (b_i + b_j)^2 . Your task is to minimize the total cost of two arrays. Each test case consists of several test cases. The first line contains a single integer t ( 1 <= q t <= q 40 ) -- the number of test cases. The following is a description of the input data sets. The first line of each test case contains an integer n ( 1 <= q n <= q 100 ) -- the length of both arrays. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 100 ) -- elements of the first array. The third line of each test case contains n integers b_1, b_2, ldots, b_n ( 1 <= q b_i <= q 100 ) -- elements of the second array. It is guaranteed that the sum of n over all test cases does not exceed 100 . For each test case, print the minimum possible total cost. In the second test case, in one of the optimal answers after all operations a = [2, 6, 4, 6] , b = [3, 7, 6, 1] . The cost of the array a equals to (2 + 6)^2 + (2 + 4)^2 + (2 + 6)^2 + (6 + 4)^2 + (6 + 6)^2 + (4 + 6)^2 = 508 . The cost of the array b equals to (3 + 7)^2 + (3 + 6)^2 + (3 + 1)^2 + (7 + 6)^2 + (7 + 1)^2 + (6 + 1)^2 = 479 . The total cost of two arrays equals to 508 + 479 = 987 . "...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
146148618 cheese-cracker D Feb. 12, 2022, 4:53 p.m. OK D TESTS 22 15 13414400
146147339 ztfgsxdgyt D Feb. 12, 2022, 4:49 p.m. OK GNU C11 TESTS 22 15 23040000
146181587 Tyyyyyy D Feb. 13, 2022, 12:21 a.m. OK GNU C++14 TESTS 23 15 0
146180857 yspm D Feb. 13, 2022, 12:01 a.m. OK GNU C++14 TESTS 23 15 0
146178915 Mryange D Feb. 12, 2022, 11:02 p.m. OK GNU C++14 TESTS 22 15 0
146178638 pranshukas D Feb. 12, 2022, 10:55 p.m. OK GNU C++14 TESTS 22 15 0
146161794 PotremZ D Feb. 12, 2022, 6:31 p.m. OK GNU C++14 TESTS 22 15 0
146197387 smallpeter D Feb. 13, 2022, 5:43 a.m. OK GNU C++14 TESTS 23 15 0
146158836 yao11617 D Feb. 12, 2022, 6:08 p.m. OK GNU C++14 TESTS 22 15 0
146186533 FLself D Feb. 13, 2022, 2:34 a.m. OK GNU C++14 TESTS 23 15 0
146197240 Lskkkno3 D Feb. 13, 2022, 5:41 a.m. OK GNU C++14 TESTS 23 15 102400
146197518 jophyyjh D Feb. 13, 2022, 5:44 a.m. OK GNU C++14 TESTS 23 15 102400
146197726 C4commander D Feb. 13, 2022, 5:46 a.m. OK GNU C++17 TESTS 23 15 0
146192673 mouryasatyam D Feb. 13, 2022, 4:37 a.m. OK GNU C++17 TESTS 23 15 0
146190901 1205691775 D Feb. 13, 2022, 4:06 a.m. OK GNU C++17 TESTS 23 15 0
146190772 1205691775 D Feb. 13, 2022, 4:03 a.m. OK GNU C++17 TESTS 23 15 0
146185444 xiece666 D Feb. 13, 2022, 2:09 a.m. OK GNU C++17 TESTS 23 15 0
146176872 16BitNarwhal D Feb. 12, 2022, 10:08 p.m. OK GNU C++17 TESTS 22 15 0
146174825 bonopo D Feb. 12, 2022, 9:25 p.m. OK GNU C++17 TESTS 22 15 0
146171380 kevin_s D Feb. 12, 2022, 8:27 p.m. OK GNU C++17 TESTS 22 15 0
146162361 Firefrog418 D Feb. 12, 2022, 6:37 p.m. OK GNU C++17 TESTS 22 15 0
146199256 han811 D Feb. 13, 2022, 6:04 a.m. OK GNU C++17 TESTS 23 15 102400
146150955 bandiaoz D Feb. 12, 2022, 4:58 p.m. OK GNU C++17 (64) TESTS 22 0 204800
146188707 202003012001 D Feb. 13, 2022, 3:25 a.m. OK GNU C++17 (64) TESTS 23 15 0
146195797 Starline D Feb. 13, 2022, 5:24 a.m. OK GNU C++17 (64) TESTS 23 15 0
146194496 pranay.2 D Feb. 13, 2022, 5:05 a.m. OK GNU C++17 (64) TESTS 23 15 0
146194008 vjudge4 D Feb. 13, 2022, 4:59 a.m. OK GNU C++17 (64) TESTS 23 15 0
146193870 WA_automata D Feb. 13, 2022, 4:57 a.m. OK GNU C++17 (64) TESTS 23 15 0
146192666 luogu_bot2 D Feb. 13, 2022, 4:37 a.m. OK GNU C++17 (64) TESTS 23 15 0
146192214 ironmans D Feb. 13, 2022, 4:29 a.m. OK GNU C++17 (64) TESTS 23 15 0
146190009 clam D Feb. 13, 2022, 3:50 a.m. OK GNU C++17 (64) TESTS 23 15 0
146184405 dfzgcj D Feb. 13, 2022, 1:42 a.m. OK GNU C++17 (64) TESTS 23 15 0
146184397 dapingguo8 D Feb. 13, 2022, 1:41 a.m. OK GNU C++20 (64) TESTS 23 0 0
146162086 Rinors D Feb. 12, 2022, 6:34 p.m. OK GNU C++20 (64) TESTS 22 0 102400
146181121 pzc2004 D Feb. 13, 2022, 12:09 a.m. OK GNU C++20 (64) TESTS 23 0 8192000
146192705 wwwprecicous D Feb. 13, 2022, 4:37 a.m. OK GNU C++20 (64) TESTS 23 15 0
146188731 SJZMDWXQKK D Feb. 13, 2022, 3:26 a.m. OK GNU C++20 (64) TESTS 23 15 0
146187719 NgYongXiang D Feb. 13, 2022, 3:03 a.m. OK GNU C++20 (64) TESTS 23 15 0
146184922 HalfStar D Feb. 13, 2022, 1:56 a.m. OK GNU C++20 (64) TESTS 23 15 0
146186684 Dinh_Quang_Huy D Feb. 13, 2022, 2:38 a.m. OK GNU C++20 (64) TESTS 23 15 0
146195996 loomt D Feb. 13, 2022, 5:26 a.m. OK GNU C++20 (64) TESTS 23 15 0
146192931 fenyman D Feb. 13, 2022, 4:41 a.m. OK GNU C++20 (64) TESTS 23 15 0
146178817 Toinfinity D Feb. 12, 2022, 10:59 p.m. OK Java 11 TESTS 22 170 0
146172337 pras7946 D Feb. 12, 2022, 8:42 p.m. OK Java 11 TESTS 22 170 5120000
146182095 Plums D Feb. 13, 2022, 12:37 a.m. OK Java 11 TESTS 23 171 0
146166227 MrOtter D Feb. 12, 2022, 7:19 p.m. OK Java 11 TESTS 22 171 0
146162458 Long214 D Feb. 12, 2022, 6:38 p.m. OK Java 11 TESTS 22 171 0
146147842 Ste D Feb. 12, 2022, 4:51 p.m. OK Java 11 TESTS 22 186 0
146192355 tdpencil D Feb. 13, 2022, 4:31 a.m. OK Java 11 TESTS 23 187 0
146160225 shojin_pro D Feb. 12, 2022, 6:18 p.m. OK Java 11 TESTS 22 187 0
146148045 kamranm D Feb. 12, 2022, 4:51 p.m. OK Java 11 TESTS 22 202 0
146156980 Dukkha D Feb. 12, 2022, 6 p.m. OK Java 11 TESTS 22 202 0
146171228 AndreySiunov D Feb. 12, 2022, 8:25 p.m. OK Java 8 TESTS 22 93 0
146161858 livd D Feb. 12, 2022, 6:32 p.m. OK Java 8 TESTS 22 93 0
146161447 ashanksingh1997 D Feb. 12, 2022, 6:28 p.m. OK Java 8 TESTS 22 93 0
146151966 DumplingLife D Feb. 12, 2022, 5:01 p.m. OK Java 8 TESTS 22 108 0
146174724 ushikawa D Feb. 12, 2022, 9:23 p.m. OK Java 8 TESTS 22 108 0
146196324 ss804 D Feb. 13, 2022, 5:30 a.m. OK Java 8 TESTS 23 109 0
146157422 MagentaCobra D Feb. 12, 2022, 6:02 p.m. OK Java 8 TESTS 22 109 0
146147626 ytu_czl D Feb. 12, 2022, 4:50 p.m. OK Java 8 TESTS 22 109 4403200
146183438 kkkkush D Feb. 13, 2022, 1:16 a.m. OK Java 8 TESTS 23 140 9113600
146180872 Abdallah_Ragab00 D Feb. 13, 2022, 12:02 a.m. OK Java 8 TESTS 23 186 66252800
146151918 koper D Feb. 12, 2022, 5:01 p.m. OK Kotlin 1.4 TESTS 22 218 2150400
146151585 Ilya_ D Feb. 12, 2022, 5 p.m. OK MS C++ 2017 TESTS 22 15 0
146178698 M7md3sam070 D Feb. 12, 2022, 10:56 p.m. OK MS C++ 2017 TESTS 22 15 204800
146148480 misaka12435 D Feb. 12, 2022, 4:52 p.m. OK MS C++ 2017 TESTS 22 15 1024000
146152385 Hideyoshi1100100001 D Feb. 12, 2022, 5:02 p.m. OK MS C++ 2017 TESTS 22 15 1536000
146173387 psn2706 D Feb. 12, 2022, 9 p.m. OK MS C++ 2017 TESTS 22 30 8396800
146171468 psn2706 D Feb. 12, 2022, 8:28 p.m. OK MS C++ 2017 TESTS 22 31 8396800
146193400 Tdyx D Feb. 13, 2022, 4:49 a.m. OK .NET Core C# TESTS 23 93 1228800
146157535 1_2_3_4_5_9 D Feb. 12, 2022, 6:02 p.m. OK PyPy 2 TESTS 22 109 1536000
146166871 eepsilon D Feb. 12, 2022, 7:26 p.m. OK PyPy 3 TESTS 22 77 2355200
146158612 SonTungMtp D Feb. 12, 2022, 6:07 p.m. OK PyPy 3 TESTS 22 77 6860800
146174496 toam D Feb. 12, 2022, 9:19 p.m. OK PyPy 3 TESTS 22 93 2252800
146180565 FlakeLCR D Feb. 12, 2022, 11:53 p.m. OK PyPy 3 TESTS 22 93 2662400
146159291 tcltk D Feb. 12, 2022, 6:11 p.m. OK PyPy 3 TESTS 22 140 4096000
146193425 Apoorv_Rathore D Feb. 13, 2022, 4:49 a.m. OK PyPy 3 TESTS 23 140 12083200
146196452 ambs_ D Feb. 13, 2022, 5:32 a.m. OK PyPy 3 TESTS 23 155 8089600
146164423 hwei002 D Feb. 12, 2022, 6:57 p.m. OK PyPy 3 TESTS 22 155 8704000
146185545 hwei002 D Feb. 13, 2022, 2:11 a.m. OK PyPy 3 TESTS 23 155 9728000
146159067 tcltk D Feb. 12, 2022, 6:10 p.m. OK PyPy 3 TESTS 22 187 4300800
146166463 Hdk2127 D Feb. 12, 2022, 7:21 p.m. OK PyPy 3-64 TESTS 22 93 9216000
146163768 vilhelmthorsson D Feb. 12, 2022, 6:50 p.m. OK PyPy 3-64 TESTS 22 93 9523200
146180286 yupooh D Feb. 12, 2022, 11:44 p.m. OK PyPy 3-64 TESTS 22 109 12288000
146168818 Skillful_Wanderer D Feb. 12, 2022, 7:51 p.m. OK PyPy 3-64 TESTS 22 109 12595200
146151827 moptranzistor D Feb. 12, 2022, 5 p.m. OK PyPy 3-64 TESTS 22 124 7065600
146198328 DarkSparkle D Feb. 13, 2022, 5:54 a.m. OK PyPy 3-64 TESTS 23 124 12288000
146153454 swoon D Feb. 12, 2022, 5:04 p.m. OK PyPy 3-64 TESTS 22 140 13107200
146165318 AbnerShen D Feb. 12, 2022, 7:08 p.m. OK PyPy 3-64 TESTS 22 140 14540800
146152112 sarthak_bharadwaj_ D Feb. 12, 2022, 5:01 p.m. OK PyPy 3-64 TESTS 22 265 33587200
146181591 coconut99 D Feb. 13, 2022, 12:22 a.m. OK PyPy 3-64 TESTS 23 499 153702400
146179372 OLOGY D Feb. 12, 2022, 11:15 p.m. OK Python 2 TESTS 22 46 204800
146157363 OLOGY D Feb. 12, 2022, 6:01 p.m. OK Python 2 TESTS 22 109 819200
146159354 tcltk D Feb. 12, 2022, 6:12 p.m. OK Python 3 TESTS 22 311 102400
146146562 sushmanth.dampur8780 D Feb. 12, 2022, 4:47 p.m. OK Python 3 TESTS 22 732 13926400
146159746 clause D Feb. 12, 2022, 6:14 p.m. OK Rust 2021 TESTS 22 15 0
146150860 46hinat D Feb. 12, 2022, 4:58 p.m. OK Rust 2021 TESTS 22 15 307200
146161766 zhhhplus D Feb. 12, 2022, 6:31 p.m. OK Rust 2021 TESTS 22 15 1024000

remove filters

Back to search problems