Codeforces Round 814 (Div. 1)

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
1718 Codeforces Round 814 (Div. 1) FINISHED False 7200 71162699 Aug. 16, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 112 ) E Impressionism PROGRAMMING constructive algorithms graphs implementation math

B'Burenka has two pictures a and b , which are tables of the same size n x m . Each cell of each painting has a color -- a number from 0 to 2 cdot 10^5 , and there are no repeating colors in any row or column of each of the two paintings, except color 0 . Burenka wants to get a picture b from the picture a . To achieve her goal, Burenka can perform one of 2 operations: swap any two rows of a or any two of its columns. Tell Burenka if she can fulfill what she wants, and if so, tell her the sequence of actions. The rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to m from left to right. The first line contains two integers n and m ( 1 <= q n cdot m <= q 2 cdot 10^5 ) -- the sizes of the table. The i -th of the next n lines contains m integers a_{i, 1}, a_{i, 2}, ldots, a_{i, m} ( 0 <= q a_{i,j} <= q 2 cdot 10^5 ) -- the colors of the i -th row of picture a . It is guaranteed that there are no identical colors in the same row or column, except color 0 . The i -th of the following n lines contains m integers b_{i, 1}, b_{i, 2}, ldots, b_{i, m} ( 0 <= q b_{i,j} <= q 2 cdot 10^5 ) -- the colors of the i -th row of picture b . It is guaranteed that there are no identical colors in the same row or column, except color 0 . In the first line print the number -1 if it is impossible to achieve what Burenka wants, otherwise print the number of actions in your solution k ( 0 <= k <= 2 cdot 10^5 ). It can be proved that if a solution exists, then there exists a solution where k <= 2 cdot 10^5 . In the next k lines print the operations. First print the type of the operation ( 1 -- swap rows, 2 -- columns), and then print the two indices of rows or columns to which the operation is applied. Note that you'...

Tutorials

Codeforces Round #814 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
168607716 Um_nik E Aug. 16, 2022, 5:48 p.m. OK GNU C++17 TESTS 91 249 24473600
168607110 zemen E Aug. 16, 2022, 5:44 p.m. OK GNU C++17 TESTS 91 264 38707200
168617835 PurpleCrayon E Aug. 16, 2022, 7:10 p.m. OK GNU C++17 (64) TESTS 91 670 61747200
168613818 errorgorn E Aug. 16, 2022, 6:31 p.m. OK GNU C++17 (64) TESTS 91 748 58060800
168631687 A_G E Aug. 16, 2022, 11:16 p.m. OK GNU C++20 (64) TESTS 91 186 32665600
168606771 greenheadstrange E Aug. 16, 2022, 5:43 p.m. OK GNU C++20 (64) TESTS 91 561 29900800
168598643 maroonrk E Aug. 16, 2022, 4:31 p.m. OK GNU C++20 (64) TESTS 91 654 71168000
168650929 maroonrk E Aug. 17, 2022, 5:05 a.m. OK GNU C++20 (64) TESTS 92 889 67891200
168614507 zeliboba E Aug. 16, 2022, 6:37 p.m. OK GNU C++20 (64) TESTS 91 1014 99942400
168615109 bashkort E Aug. 16, 2022, 6:42 p.m. OK GNU C++20 (64) TESTS 91 1465 60006400
168610472 aqxa E Aug. 16, 2022, 6:05 p.m. OK GNU C++20 (64) TESTS 91 1543 60825600
168610134 aqxa E Aug. 16, 2022, 6:03 p.m. OK GNU C++20 (64) TESTS 91 1653 60825600
168610266 ksun48 E Aug. 16, 2022, 6:04 p.m. OK GNU C++20 (64) TESTS 91 1918 18944000

remove filters

Back to search problems