Kotlin Heroes: Episode 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
1211 Kotlin Heroes: Episode 2 FINISHED False 9000 169572287 Sept. 7, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 41 ) I Unusual Graph PROGRAMMING *special graphs 3000

B"Ivan on his birthday was presented with array of non-negative integers a_1, a_2, ldots, a_n . He immediately noted that all a_i satisfy the condition 0 <= q a_i <= q 15 . Ivan likes graph theory very much, so he decided to transform his sequence to the graph. There will be n vertices in his graph, and vertices u and v will present in the graph if and only if binary notations of integers a_u and a_v are differ in exactly one bit (in other words, a_u oplus a_v = 2^k for some integer k geq 0 . Where oplus is Bitwise XOR). A terrible thing happened in a couple of days, Ivan forgot his sequence a , and all that he remembers is constructed graph! Can you help him, and find any sequence a_1, a_2, ldots, a_n , such that graph constructed by the same rules that Ivan used will be the same as his graph? The first line of input contain two integers n,m ( 1 <= q n <= q 500, 0 <= q m <= q frac{n(n-1)}{2} ): number of vertices and edges in Ivan's graph. Next m lines contain the description of edges: i -th line contain two integers u_i, v_i ( 1 <= q u_i, v_i <= q n; u_i neq v_i ), describing undirected edge connecting vertices u_i and v_i in the graph. It is guaranteed that there are no multiple edges in the graph. It is guaranteed that there exists some solution for the given graph. Output n space-separated integers, a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 15 ). Printed numbers should satisfy the constraints: edge between vertices u and v present in the graph if and only if a_u oplus a_v = 2^k for some integer k geq 0 . It is guaranteed that there exists some solution for the given graph. If there are multiple possible solutions, you can output any. "...

Tutorials

Kotlin Heroes: Episode 2 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
60231681 eatmore I Sept. 7, 2019, 4:41 p.m. OK Kotlin TESTS 155 140 0 3000
63659660 KenBIL-8-Bekmurat I Oct. 28, 2019, 1:43 p.m. OK Kotlin TESTS 155 218 307200 3000
61402935 vjudge2 I Sept. 28, 2019, 5:58 a.m. OK Kotlin TESTS 155 218 307200 3000
60927007 112 I Sept. 20, 2019, 12:34 p.m. OK Kotlin TESTS 155 234 307200 3000
60232590 MiFaFaOvO I Sept. 7, 2019, 4:59 p.m. OK Kotlin TESTS 155 234 307200 3000
60229477 tourist I Sept. 7, 2019, 4:01 p.m. OK Kotlin TESTS 155 234 1331200 3000
66455488 Shajib_ I Dec. 7, 2019, 1 p.m. OK Kotlin TESTS 155 249 307200 3000
61376502 mk_mrznv_lx I Sept. 27, 2019, 4:24 p.m. OK Kotlin TESTS 155 249 307200 3000
60233257 ecnerwala I Sept. 7, 2019, 5:11 p.m. OK Kotlin TESTS 155 249 307200 3000
60231674 Benq I Sept. 7, 2019, 4:41 p.m. OK Kotlin TESTS 155 265 307200 3000

remove filters

Back to search problems