Codeforces Round 495 (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
1004 Codeforces Round 495 (Div. 2) FINISHED False 7200 201014699 July 5, 2018, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1427 ) D Sonya and Matrix PROGRAMMING brute force constructive algorithms implementation 2200

B'Since Sonya has just learned the basics of matrices, she decided to play with them a little bit. Sonya imagined a new type of matrices that she called rhombic matrices. These matrices have exactly one zero, while all other cells have the Manhattan distance to the cell containing the zero. The cells with equal numbers have the form of a rhombus, that is why Sonya called this type so. The Manhattan distance between two cells ( x_1 , y_1 ) and ( x_2 , y_2 ) is defined as |x_1 - x_2| + |y_1 - y_2| . For example, the Manhattan distance between the cells (5, 2) and (7, 1) equals to |5-7|+|2-1|=3 . Note that rhombic matrices are uniquely defined by n , m , and the coordinates of the cell containing the zero. She drew a n x m rhombic matrix. She believes that you can not recreate the matrix if she gives you only the elements of this matrix in some arbitrary order (i.e., the sequence of n cdot m numbers). Note that Sonya will not give you n and m , so only the sequence of numbers in this matrix will be at your disposal. Write a program that finds such an n x m rhombic matrix whose elements are the same as the elements in the sequence in some order. The first line contains a single integer t ( 1 <= q t <= q 10^6 ) -- the number of cells in the matrix. The second line contains t integers a_1, a_2, ldots, a_t ( 0 <= q a_i< t ) -- the values in the cells in arbitrary order. In the first line, print two positive integers n and m ( n x m = t ) -- the size of the matrix. In the second line, print two integers x and y ( 1 <= q x <= q n , 1 <= q y <= q m ) -- the row number and the column number where the cell with 0 is located. If there are multiple possible answers, print any of them. If there is no solution, print the single integer -1 . You can see the solution to the first example in the legend. You also'...

Tutorials

60443

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
39996575 Gay_cc D July 5, 2018, 5:05 p.m. OK GNU C++ TESTS 47 109 7987200 2200
40001709 CHENXI D July 5, 2018, 5:45 p.m. OK GNU C++ TESTS 47 217 11161600 2200
40004049 HIT_PINKG D July 5, 2018, 6:10 p.m. OK GNU C++ TESTS 47 233 7987200 2200
40006190 VisJiao D July 5, 2018, 6:33 p.m. OK GNU C++ TESTS 47 265 7884800 2200
40004244 Wagn3rd D July 5, 2018, 6:12 p.m. OK GNU C++ TESTS 47 733 8089600 2200
40005382 zkp D July 5, 2018, 6:25 p.m. OK GNU C++ TESTS 47 1902 12083200 2200
40001387 lajiniunai D July 5, 2018, 5:42 p.m. OK GNU C++11 TESTS 47 218 12083200 2200
40001830 zetamoo D July 5, 2018, 5:46 p.m. OK GNU C++11 TESTS 47 233 7987200 2200
40003970 EZ_fwtt08 D July 5, 2018, 6:09 p.m. OK GNU C++11 TESTS 47 234 24064000 2200
40004279 mredigonda D July 5, 2018, 6:13 p.m. OK GNU C++11 TESTS 47 249 7987200 2200
40000703 little_misfortune D July 5, 2018, 5:36 p.m. OK GNU C++11 TESTS 47 249 8089600 2200
40004313 repeating D July 5, 2018, 6:13 p.m. OK GNU C++11 TESTS 47 264 7987200 2200
40003345 antguz D July 5, 2018, 6:02 p.m. OK GNU C++11 TESTS 47 264 7987200 2200
40002296 Doppio D July 5, 2018, 5:51 p.m. OK GNU C++11 TESTS 47 264 8089600 2200
39999857 Juzek D July 5, 2018, 5:28 p.m. OK GNU C++11 TESTS 47 295 7884800 2200
40002608 nimphy D July 5, 2018, 5:54 p.m. OK GNU C++11 TESTS 47 311 8192000 2200
40003957 surokpro D July 5, 2018, 6:09 p.m. OK GNU C++14 TESTS 47 280 7987200 2200
40003413 AlanWaP D July 5, 2018, 6:03 p.m. OK GNU C++14 TESTS 47 295 3993600 2200
40002862 dest.31337 D July 5, 2018, 5:57 p.m. OK GNU C++14 TESTS 47 295 12288000 2200
40005689 kulpet345 D July 5, 2018, 6:28 p.m. OK GNU C++14 TESTS 47 311 7987200 2200
40001797 antony191 D July 5, 2018, 5:46 p.m. OK GNU C++14 TESTS 47 311 7987200 2200
39999974 Physicist D July 5, 2018, 5:29 p.m. OK GNU C++14 TESTS 47 311 7987200 2200
40003612 Emiso D July 5, 2018, 6:05 p.m. OK GNU C++14 TESTS 47 311 8089600 2200
40003227 superman_k D July 5, 2018, 6:01 p.m. OK GNU C++14 TESTS 47 312 7987200 2200
40004953 Naoki_M D July 5, 2018, 6:20 p.m. OK GNU C++14 TESTS 47 312 12083200 2200
40000746 CARLAO_BORRACHA D July 5, 2018, 5:36 p.m. OK GNU C++14 TESTS 47 312 12083200 2200
40000208 fdoer D July 5, 2018, 5:31 p.m. OK GNU C++17 TESTS 47 296 7987200 2200
40005281 HIT_TOM D July 5, 2018, 6:24 p.m. OK GNU C++17 TESTS 47 296 12083200 2200
40005273 xh286286 D July 5, 2018, 6:24 p.m. OK GNU C++17 TESTS 47 311 8806400 2200
40005754 w4ynebbcola D July 5, 2018, 6:29 p.m. OK GNU C++17 TESTS 47 312 3993600 2200
40004720 sddyzjh D July 5, 2018, 6:18 p.m. OK GNU C++17 TESTS 47 312 7987200 2200
40005977 LordVoldebug D July 5, 2018, 6:31 p.m. OK GNU C++17 TESTS 47 312 24064000 2200
40005279 Smaug D July 5, 2018, 6:24 p.m. OK GNU C++17 TESTS 47 342 7987200 2200
40002854 kzvd4729 D July 5, 2018, 5:57 p.m. OK GNU C++17 TESTS 47 358 19968000 2200
40004806 ybmj D July 5, 2018, 6:19 p.m. OK GNU C++17 TESTS 47 389 10444800 2200
40003630 2014CAIS01 D July 5, 2018, 6:06 p.m. OK GNU C++17 TESTS 47 404 10444800 2200
40005900 hiromi_ayase D July 5, 2018, 6:30 p.m. OK Java 8 TESTS 47 327 37990400 2200
39997755 kiwikiwi D July 5, 2018, 5:12 p.m. OK Java 8 TESTS 47 452 64102400 2200
40005068 Asgar D July 5, 2018, 6:22 p.m. OK Java 8 TESTS 47 467 41779200 2200

remove filters

Back to search problems