Pinely Round 4 (Div. 1 + 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
1991 Pinely Round 4 (Div. 1 + Div. 2) FINISHED False 10800 15002663 July 28, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6854 ) D Prime XOR Coloring PROGRAMMING bitmasks constructive algorithms graphs greedy math number theory

B'You are given an undirected graph with n vertices, numbered from 1 to n . There is an edge between vertices u and v if and only if u oplus v is a prime number, where oplus denotes the bitwise XOR operator. Color all vertices of the graph using the minimum number of colors, such that no two vertices directly connected by an edge have the same color. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 500 ). The description of test cases follows. The only line contains a single integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of vertices in the graph. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output two lines. The first line should contain a single integer k ( 1 <= k <= n ) -- the minimum number of colors required. The second line should contain n integers c_1, c_2, ldots, c_n ( 1 <= c_i <= k ) -- the color of each vertex. If there are multiple solutions, output any of them. In the first test case, the minimum number of colors is 1 , because there is only one vertex. In the second test case, the minimum number of colors is 2 , because there is an edge connecting 1 and 2 ( 1 oplus 2 = 3 , which is a prime number). In the third test case, the minimum number of colors is still 2 , because 2 and 3 can be colored the same since there is no edge between 2 and 3 ( 2 oplus 3 = 1 , which is not a prime number). In the fourth test case, it can be shown that the minimum number of colors is 3 . In the fifth test case, it can be shown that the minimum number of colors is 3 . In the sixth test case, it can be shown that the minimum number of colors is 4 . '...

Tutorials

Video Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
273225610 nice12 D July 28, 2024, 5:27 p.m. OK C# 10 TESTS 10 124 13312000
273258149 tejasvi.aynor D July 29, 2024, 1:04 a.m. OK C++14 (GCC 6-32) TESTS 10 46 0
273255489 yeminghan D July 29, 2024, 12:11 a.m. OK C++14 (GCC 6-32) TESTS 10 46 0
273261174 wzxsdf D July 29, 2024, 1:46 a.m. OK C++14 (GCC 6-32) TESTS 10 46 7475200
273266780 GGapa D July 29, 2024, 2:51 a.m. OK C++14 (GCC 6-32) TESTS 10 61 0
273261874 bs_commander D July 29, 2024, 1:55 a.m. OK C++14 (GCC 6-32) TESTS 10 61 409600
273255984 chenye3 D July 29, 2024, 12:23 a.m. OK C++14 (GCC 6-32) TESTS 10 61 1638400
273282509 4927618350 D July 29, 2024, 5:52 a.m. OK C++14 (GCC 6-32) TESTS 10 62 0
273282109 Wilson_Lee D July 29, 2024, 5:48 a.m. OK C++14 (GCC 6-32) TESTS 10 62 0
273281523 Zhi_zI D July 29, 2024, 5:42 a.m. OK C++14 (GCC 6-32) TESTS 10 62 0
273280324 xinyu123_AKIOI D July 29, 2024, 5:29 a.m. OK C++14 (GCC 6-32) TESTS 10 62 0
273277693 jh01533 D July 29, 2024, 5 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273274467 emni_o D July 29, 2024, 4:21 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273270782 interps D July 29, 2024, 3:37 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273261460 atharvd D July 29, 2024, 1:50 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273260946 Bluejellyfish D July 29, 2024, 1:42 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273259658 NeikuiColacat D July 29, 2024, 1:25 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
273259106 frustrated-dev D July 29, 2024, 1:18 a.m. OK C++17 (GCC 7-32) TESTS 10 46 204800
273221354 VICUNA666 D July 28, 2024, 5:17 p.m. OK C++17 (GCC 7-32) TESTS 10 46 5017600
273282048 chmpy D July 29, 2024, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 10 61 0
273275974 AM_2162 D July 29, 2024, 4:39 a.m. OK C++17 (GCC 7-32) TESTS 10 61 0
273283731 svaze D July 29, 2024, 6:03 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273283623 akihayashi D July 29, 2024, 6:02 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273283381 detailest D July 29, 2024, 6 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273282663 bbyyd D July 29, 2024, 5:53 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273280060 NotDWT D July 29, 2024, 5:26 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273278749 mo1234560 D July 29, 2024, 5:11 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273278492 sccccc D July 29, 2024, 5:08 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273278213 Ngeces D July 29, 2024, 5:05 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273277737 samarth__717 D July 29, 2024, 5 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273276827 Reinforcer D July 29, 2024, 4:49 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
273276083 fanfly D July 29, 2024, 4:41 a.m. OK GNU C11 TESTS 10 781 102400
273224147 lnsuyn D July 28, 2024, 5:24 p.m. OK GNU C11 TESTS 10 827 102400
273229077 Moka50 D July 28, 2024, 5:34 p.m. OK GNU C11 TESTS 10 1499 819200
273243257 october_rain D July 28, 2024, 8:18 p.m. OK Haskell TESTS 10 217 2048000
273251354 dzhi D July 28, 2024, 10:36 p.m. OK Java 21 TESTS 10 250 409600
273236022 polsage D July 28, 2024, 7:02 p.m. OK Java 21 TESTS 10 280 204800
273252886 pranp_24 D July 28, 2024, 11:09 p.m. OK Java 21 TESTS 10 281 614400
273237932 PlayDate D July 28, 2024, 7:17 p.m. OK Java 21 TESTS 10 281 1228800
273279179 vinay_panwar D July 29, 2024, 5:16 a.m. OK Java 21 TESTS 10 312 512000
273280749 codeWithDarshan D July 29, 2024, 5:34 a.m. OK Java 21 TESTS 10 327 819200
273227297 vatsal_04 D July 28, 2024, 5:31 p.m. OK Java 21 TESTS 10 327 3891200
273240566 rumblegod D July 28, 2024, 7:44 p.m. OK Java 21 TESTS 10 531 1126400
273236120 azhar1612001 D July 28, 2024, 7:03 p.m. OK Java 21 TESTS 10 577 1228800
273243774 asingh2112 D July 28, 2024, 8:27 p.m. OK Java 21 TESTS 10 577 1740800
273279740 leonlian D July 29, 2024, 5:22 a.m. OK Java 8 TESTS 10 155 0
273276420 kartik__sethi D July 29, 2024, 4:45 a.m. OK Java 8 TESTS 10 171 0
273237797 Eslam_Ahmed D July 28, 2024, 7:16 p.m. OK Java 8 TESTS 10 171 0
273260188 nikhil97agra D July 29, 2024, 1:33 a.m. OK Java 8 TESTS 10 187 0
273282342 CipherSphinx_Raj D July 29, 2024, 5:50 a.m. OK Java 8 TESTS 10 187 39321600
273227927 aishwarykesarwani D July 28, 2024, 5:33 p.m. OK Java 8 TESTS 10 234 0
273223125 codeanand17 D July 28, 2024, 5:21 p.m. OK Java 8 TESTS 10 515 0
273247811 devpascal D July 28, 2024, 9:29 p.m. OK Node.js TESTS 10 171 21401600
273228452 skhan40208 D July 28, 2024, 5:33 p.m. OK Node.js TESTS 10 171 21401600
273235410 shilpabanerjee50 D July 28, 2024, 6:59 p.m. OK PyPy 2 TESTS 10 108 6144000
273228603 Blacky_69 D July 28, 2024, 5:34 p.m. OK PyPy 2 TESTS 10 171 6451200
273220956 harshdew16 D July 28, 2024, 5:16 p.m. OK PyPy 3 TESTS 10 156 15257600
273260130 bpdolson D July 29, 2024, 1:32 a.m. OK PyPy 3 TESTS 10 202 15769600
273227694 najmiddinweb D July 28, 2024, 5:32 p.m. OK PyPy 3 TESTS 10 218 15257600
273236311 abbasslb D July 28, 2024, 7:04 p.m. OK PyPy 3 TESTS 10 233 9318400
273226276 Dantevale D July 28, 2024, 5:29 p.m. OK PyPy 3 TESTS 10 233 15360000
273237355 Shaydiesin D July 28, 2024, 7:12 p.m. OK PyPy 3 TESTS 10 249 9113600
273240534 Adith1000 D July 28, 2024, 7:43 p.m. OK PyPy 3 TESTS 10 264 9113600
273280818 poseidontom D July 29, 2024, 5:34 a.m. OK PyPy 3 TESTS 10 265 9216000
273249406 helen_strakhal D July 28, 2024, 9:58 p.m. OK PyPy 3 TESTS 10 265 9830400
273225302 Mamba_AI D July 28, 2024, 5:27 p.m. OK PyPy 3-64 TESTS 10 93 7884800
273273171 gardengnome D July 29, 2024, 4:05 a.m. OK PyPy 3-64 TESTS 10 109 5529600
273246004 Monocrap D July 28, 2024, 9:03 p.m. OK PyPy 3-64 TESTS 10 109 18636800
273238859 RobinFromTheHood D July 28, 2024, 7:25 p.m. OK PyPy 3-64 TESTS 10 109 18636800
273219676 shubham_redoc D July 28, 2024, 5:12 p.m. OK PyPy 3-64 TESTS 10 124 4300800
273221578 iau_1371 D July 28, 2024, 5:17 p.m. OK PyPy 3-64 TESTS 10 124 7884800
273224471 Abdulxay4545 D July 28, 2024, 5:25 p.m. OK PyPy 3-64 TESTS 10 124 8806400
273271882 zhtg D July 29, 2024, 3:50 a.m. OK PyPy 3-64 TESTS 10 124 8908800
273250340 Ahsan612 D July 28, 2024, 10:15 p.m. OK PyPy 3-64 TESTS 10 124 9113600
273244319 skshitij269 D July 28, 2024, 8:37 p.m. OK PyPy 3-64 TESTS 10 124 12492800
273280708 normalcoder12 D July 29, 2024, 5:33 a.m. OK Python 3 TESTS 10 124 19558400
273275396 ryanimal D July 29, 2024, 4:32 a.m. OK Python 3 TESTS 10 124 19763200
273227779 rahulkumar4790965 D July 28, 2024, 5:32 p.m. OK Python 3 TESTS 10 155 21401600
273219889 sabarna1308 D July 28, 2024, 5:13 p.m. OK Python 3 TESTS 10 171 19251200
273224297 ok12 D July 28, 2024, 5:24 p.m. OK Python 3 TESTS 10 171 21401600
273241580 sarthakj314 D July 28, 2024, 7:55 p.m. OK Python 3 TESTS 10 249 4403200
273220062 Last__killua D July 28, 2024, 5:13 p.m. OK Ruby 3 TESTS 10 405 6144000
273239337 fieubat2x D July 28, 2024, 7:30 p.m. OK Rust 2021 TESTS 10 62 0
273239343 SnowballSH D July 28, 2024, 7:30 p.m. OK Rust 2021 TESTS 10 77 8499200

remove filters

Back to search problems