Codeforces Round 508 (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
1038 Codeforces Round 508 (Div. 2) FINISHED False 7200 195575099 Sept. 6, 2018, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 988 ) E Maximum Matching PROGRAMMING bitmasks brute force dfs and similar dp graphs 2400

B'You are given n blocks, each of them is of the form [color _1 |value|color _2 ], where the block can also be flipped to get [color _2 |value|color _1 ]. A sequence of blocks is called valid if the touching endpoints of neighboring blocks have the same color. For example, the sequence of three blocks A, B and C is valid if the left color of the B is the same as the right color of the A and the right color of the B is the same as the left color of C. The value of the sequence is defined as the sum of the values of the blocks in this sequence. Find the maximum possible value of the valid sequence that can be constructed from the subset of the given blocks. The blocks from the subset can be reordered and flipped if necessary. Each block can be used at most once in the sequence. The first line of input contains a single integer n ( 1 <= n <= 100 ) -- the number of given blocks. Each of the following n lines describes corresponding block and consists of mathrm{color}_{1,i} , mathrm{value}_i and mathrm{color}_{2,i} ( 1 <= mathrm{color}_{1,i}, mathrm{color}_{2,i} <= 4 , 1 <= mathrm{value}_i <= 100 ,000 ). Print exactly one integer -- the maximum total value of the subset of blocks, which makes a valid sequence. In the first example, it is possible to form a valid sequence from all blocks. One of the valid sequences is the following: [4|2|1] [1|32|2] [2|8|3] [3|16|3] [3|4|4] [4|1|2] The first block from the input ([2|1|4] to [4|1|2]) and second ([1|2|4] to [4|2|1]) are flipped. In the second example, the optimal answers can be formed from the first three blocks as in the following (the second or the third block from the input is flipped): [2|100000|1] [1|100000|1] [1|100000|2] In the third example, it is not possible to form a valid sequence of two or more blocks, so the answer is a sequence consisting only of the first block since it is the block with the largest value. '...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
42591873 fluffyowl E Sept. 6, 2018, 8:14 p.m. OK D TESTS 116 46 0 2400
69177626 vjudge1 E Jan. 20, 2020, 8:43 a.m. OK GNU C++11 TESTS 117 31 0 2400
64886250 luogu_bot1 E Nov. 14, 2019, 1:12 p.m. OK GNU C++11 TESTS 117 31 0 2400
64886171 Juanzhang E Nov. 14, 2019, 1:11 p.m. OK GNU C++11 TESTS 117 31 0 2400
61601621 nitrogens E Oct. 1, 2019, 11:12 a.m. OK GNU C++11 TESTS 117 31 0 2400
61599288 nitrogens E Oct. 1, 2019, 10:13 a.m. OK GNU C++11 TESTS 117 31 0 2400
60965683 __trrbivial_innocence E Sept. 21, 2019, 6:56 a.m. OK GNU C++11 TESTS 117 31 0 2400
57924511 vjudge5 E July 29, 2019, 6:35 a.m. OK GNU C++11 TESTS 117 31 0 2400
55190765 Amidethuong27 E June 6, 2019, 6:22 a.m. OK GNU C++11 TESTS 117 31 0 2400
55190744 Amidethuong27 E June 6, 2019, 6:21 a.m. OK GNU C++11 TESTS 117 31 0 2400
55190638 Amidethuong27 E June 6, 2019, 6:18 a.m. OK GNU C++11 TESTS 117 31 0 2400
64191956 cimh E Nov. 4, 2019, 8:06 a.m. OK GNU C++14 TESTS 117 31 0 2400
62364792 Scut82 E Oct. 11, 2019, 1:31 p.m. OK GNU C++14 TESTS 117 31 0 2400
52354839 DimmyT E April 5, 2019, 4:17 p.m. OK GNU C++14 TESTS 117 31 0 2400
50432001 cuiaoxiang E Feb. 24, 2019, 2:34 p.m. OK GNU C++14 TESTS 117 31 0 2400
50322375 vjudge1 E Feb. 22, 2019, 3:05 p.m. OK GNU C++14 TESTS 117 31 0 2400
46049525 Jeffrey E Nov. 22, 2018, 6:10 a.m. OK GNU C++14 TESTS 117 31 0 2400
45752304 mean2k1 E Nov. 15, 2018, 2:33 a.m. OK GNU C++14 TESTS 117 31 0 2400
45210398 vjudge5 E Nov. 2, 2018, 2:52 p.m. OK GNU C++14 TESTS 117 31 0 2400
44755176 zh1135 E Oct. 23, 2018, 11:54 p.m. OK GNU C++14 TESTS 117 31 0 2400
44428493 pazabol E Oct. 17, 2018, 6:16 a.m. OK GNU C++14 TESTS 117 31 0 2400
49957027 atrophy98 E Feb. 15, 2019, 4:32 p.m. OK GNU C++17 TESTS 117 30 204800 2400
42591560 nasadigital E Sept. 6, 2018, 8:07 p.m. OK GNU C++17 TESTS 116 30 204800 2400
52519704 Houbunsha E April 9, 2019, 7:57 a.m. OK GNU C++17 TESTS 117 30 409600 2400
42811413 Juve45 E Sept. 12, 2018, 8:21 p.m. OK GNU C++17 TESTS 117 30 409600 2400
42695978 ReaLNero1 E Sept. 9, 2018, 7:11 a.m. OK GNU C++17 TESTS 117 30 409600 2400
42613704 mohamedeltair E Sept. 7, 2018, 12:34 p.m. OK GNU C++17 TESTS 117 30 409600 2400
57938961 balbit E July 29, 2019, 11:53 a.m. OK GNU C++17 TESTS 117 31 0 2400
52571302 endereye E April 10, 2019, 2:18 p.m. OK GNU C++17 TESTS 117 31 0 2400
50676689 biaoge E March 2, 2019, 9:33 a.m. OK GNU C++17 TESTS 117 31 0 2400
46999439 3liAckerman E Dec. 14, 2018, 10:42 a.m. OK GNU C++17 TESTS 117 31 0 2400
45156833 donli E Nov. 1, 2018, 3:43 a.m. OK Java 8 TESTS 117 124 0 2400
43997892 SrapZark E Oct. 8, 2018, 12:23 p.m. OK Java 8 TESTS 117 139 0 2400
43999185 SrapZark E Oct. 8, 2018, 12:54 p.m. OK Java 8 TESTS 117 140 0 2400
43998875 SrapZark E Oct. 8, 2018, 12:46 p.m. OK Java 8 TESTS 117 140 0 2400
42767474 vikashkumarbissu E Sept. 11, 2018, 1:52 p.m. OK Java 8 TESTS 117 140 0 2400
68967577 dalt E Jan. 17, 2020, 5:42 a.m. OK Java 8 TESTS 117 140 19558400 2400
42588216 amnesiac_dusk E Sept. 6, 2018, 5:32 p.m. OK Java 8 TESTS 116 155 0 2400
42588210 sturdyplum E Sept. 6, 2018, 5:32 p.m. OK Java 8 TESTS 116 155 0 2400
43997795 SrapZark E Oct. 8, 2018, 12:20 p.m. OK Java 8 TESTS 117 156 0 2400
43998779 SrapZark E Oct. 8, 2018, 12:44 p.m. OK Java 8 TESTS 117 170 0 2400
44735943 24khandsome E Oct. 23, 2018, 12:49 p.m. OK MS C++ TESTS 117 31 0 2400
42607495 Ancient_mage E Sept. 7, 2018, 8:53 a.m. OK MS C++ TESTS 117 31 307200 2400
44027535 remoon E Oct. 9, 2018, 8:48 a.m. OK MS C++ TESTS 117 46 1433600 2400
69245784 wawahaha E Jan. 21, 2020, 12:52 p.m. OK MS C++ TESTS 117 62 1126400 2400
69174963 vjudge4 E Jan. 20, 2020, 7:44 a.m. OK MS C++ TESTS 117 62 1228800 2400
69179696 vjudge3 E Jan. 20, 2020, 9:33 a.m. OK MS C++ TESTS 117 93 2355200 2400
42588064 BaturaDima E Sept. 6, 2018, 5:31 p.m. OK MS C++ TESTS 116 420 19558400 2400
62107733 AleksanderBalobanov E Oct. 8, 2019, 11:19 a.m. OK MS C++ 2017 TESTS 117 31 13209600 2400
42582152 ecnerwala E Sept. 6, 2018, 4:58 p.m. OK PyPy 3 TESTS 116 156 0 2400
43426151 DedMartyn E Sept. 25, 2018, 8:20 p.m. OK PyPy 3 TESTS 117 358 3584000 2400
42598388 WNG E Sept. 7, 2018, 2:35 a.m. OK Python 2 TESTS 117 186 0 2400
43169565 Tosic E Sept. 21, 2018, 7:27 a.m. OK Python 3 TESTS 117 139 0 2400
42586292 anagohirame E Sept. 6, 2018, 5:21 p.m. OK Python 3 TESTS 116 140 0 2400
42581700 bigcat111 E Sept. 6, 2018, 4:55 p.m. OK Python 3 TESTS 116 171 204800 2400
42608037 ikovrigin E Sept. 7, 2018, 9:12 a.m. OK Python 3 TESTS 117 576 2457600 2400
42704026 yakamoto E Sept. 9, 2018, 12:09 p.m. OK Scala TESTS 117 748 614400 2400

remove filters

Back to search problems