Codeforces Global Round 4

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
1178 Codeforces Global Round 4 FINISHED False 9000 168186299 July 20, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 7434 ) D Prime Graph PROGRAMMING constructive algorithms greedy math number theory 1600

B"Every person likes prime numbers. Alice is a person, thus she also shares the love for them. Bob wanted to give her an affectionate gift but couldn't think of anything inventive. Hence, he will be giving her a graph. How original, Bob! Alice will surely be thrilled! When building the graph, he needs four conditions to be satisfied: Below is an example for n = 4 . The first graph (left one) is invalid as the degree of vertex 2 (and 4 ) equals to 1 , which is not prime. The second graph (middle one) is invalid as the total number of edges is 4 , which is not a prime number. The third graph (right one) is a valid answer for n = 4 . Note that the graph can be disconnected. Please help Bob to find any such graph! The input consists of a single integer n ( 3 <= q n <= q 1 ,000 ) -- the number of vertices. If there is no graph satisfying the conditions, print a single line containing the integer -1 . Otherwise, first print a line containing a prime number m ( 2 <= q m <= q frac{n(n-1)}{2} ) -- the number of edges in the graph. Then, print m lines, the i -th of which containing two integers u_i , v_i ( 1 <= q u_i, v_i <= q n ) -- meaning that there is an edge between vertices u_i and v_i . The degree of each vertex must be prime. There must be no multiple (parallel) edges or self-loops. If there are multiple solutions, you may print any of them. Note that the graph can be disconnected. The first example was described in the statement. In the second example, the degrees of vertices are [7, 5, 2, 2, 3, 2, 2, 3] . Each of these numbers is prime. Additionally, the number of edges, 13 , is also a prime number, hence both conditions are satisfied. "...

Tutorials

E

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
57414163 ruban D July 20, 2019, 5:26 p.m. OK Delphi TESTS 37 31 0 1600
57487338 MRoy D July 22, 2019, 5:52 a.m. OK GNU C11 TESTS 37 31 0 1600
57404464 lminsl D July 20, 2019, 4:34 p.m. OK GNU C11 TESTS 37 31 0 1600
57402065 4c5948 D July 20, 2019, 4:24 p.m. OK GNU C11 TESTS 37 31 0 1600
57415591 DanielixS D July 20, 2019, 5:35 p.m. OK GNU C11 TESTS 37 31 10444800 1600
61061234 nikhilreddy123 D Sept. 22, 2019, 9:32 a.m. OK GNU C11 TESTS 37 46 0 1600
57418860 _Rebellion D July 20, 2019, 5:56 p.m. OK GNU C11 TESTS 37 46 0 1600
57431773 guanhuai04 D July 21, 2019, 2:02 a.m. OK GNU C++11 TESTS 37 30 0 1600
57426394 aymanrasheed7 D July 20, 2019, 8:40 p.m. OK GNU C++11 TESTS 37 30 0 1600
57424060 michao D July 20, 2019, 7:30 p.m. OK GNU C++11 TESTS 37 30 0 1600
57413732 mini4141 D July 20, 2019, 5:23 p.m. OK GNU C++11 TESTS 37 30 0 1600
59263621 dado612 D Aug. 22, 2019, 9:42 a.m. OK GNU C++11 TESTS 37 30 0 1600
58673008 amokrousov D Aug. 12, 2019, 3:12 p.m. OK GNU C++11 TESTS 37 30 0 1600
57509953 luogu_bot2 D July 22, 2019, 1:24 p.m. OK GNU C++11 TESTS 37 30 0 1600
57461123 White_Lion D July 21, 2019, 1:41 p.m. OK GNU C++11 TESTS 37 30 0 1600
57441845 jakob99 D July 21, 2019, 7 a.m. OK GNU C++11 TESTS 37 30 0 1600
57437252 yangyuchen D July 21, 2019, 5:29 a.m. OK GNU C++11 TESTS 37 30 0 1600
62535834 zeus_iitg D Oct. 13, 2019, 10:21 p.m. OK GNU C++14 TESTS 37 15 0 1600
61560108 GAUmar D Sept. 30, 2019, 3:16 p.m. OK GNU C++14 TESTS 37 15 0 1600
58714666 fdilwale683 D Aug. 13, 2019, 1:36 p.m. OK GNU C++14 TESTS 37 15 0 1600
58533915 akifpathan D Aug. 10, 2019, 10:55 a.m. OK GNU C++14 TESTS 37 15 0 1600
68306933 DMCS D Jan. 6, 2020, 9:22 a.m. OK GNU C++14 TESTS 37 15 0 1600
68306784 DMCS D Jan. 6, 2020, 9:18 a.m. OK GNU C++14 TESTS 37 15 0 1600
67795735 nidhirapara D Dec. 28, 2019, 4:33 p.m. OK GNU C++14 TESTS 37 15 0 1600
67669695 TheCerberus D Dec. 26, 2019, 7:37 p.m. OK GNU C++14 TESTS 37 15 0 1600
66410290 kurakura D Dec. 6, 2019, 3:05 p.m. OK GNU C++14 TESTS 37 15 0 1600
64069301 Scut82 D Nov. 2, 2019, 6:52 a.m. OK GNU C++14 TESTS 37 15 0 1600
57452122 AlessioZeni D July 21, 2019, 10:07 a.m. OK GNU C++17 TESTS 37 15 0 1600
68012500 R_K_C D Dec. 31, 2019, 4:34 p.m. OK GNU C++17 TESTS 37 15 0 1600
60583676 Four_Aces D Sept. 14, 2019, 7:45 p.m. OK GNU C++17 TESTS 37 15 0 1600
59951538 Dilshod--Imomov D Sept. 3, 2019, 2:41 p.m. OK GNU C++17 TESTS 37 15 0 1600
59191577 ferryfulei D Aug. 20, 2019, 9:35 p.m. OK GNU C++17 TESTS 37 15 0 1600
58215989 .MK7. D Aug. 3, 2019, 10:46 a.m. OK GNU C++17 TESTS 37 15 0 1600
57512042 Andrija D July 22, 2019, 2:12 p.m. OK GNU C++17 TESTS 37 15 0 1600
57508618 GoWind D July 22, 2019, 12:54 p.m. OK GNU C++17 TESTS 37 15 0 1600
57440521 hawwyo D July 21, 2019, 6:36 a.m. OK GNU C++17 TESTS 37 15 0 1600
57436258 ayushsinghiitr D July 21, 2019, 4:56 a.m. OK GNU C++17 TESTS 37 15 0 1600
58642043 vjudge2 D Aug. 12, 2019, 4:07 a.m. OK Go TESTS 37 31 0 1600
57402274 life_is_not_bed_of_roses D July 20, 2019, 4:25 p.m. OK Go TESTS 37 31 0 1600
58640719 NCE D Aug. 12, 2019, 3:23 a.m. OK Go TESTS 37 46 0 1600
57405637 kirigiri D July 20, 2019, 4:40 p.m. OK Haskell TESTS 37 46 102400 1600
63825791 prituladima D Oct. 30, 2019, 1:22 p.m. OK Java 11 TESTS 37 233 0 1600
62928432 shaurya_singh D Oct. 19, 2019, noon OK Java 8 TESTS 37 109 0 1600
62913865 aman28rwt D Oct. 19, 2019, 8:08 a.m. OK Java 8 TESTS 37 109 0 1600
57551808 alibaba D July 22, 2019, 5:47 p.m. OK Java 8 TESTS 37 109 0 1600
57503848 instant_crush D July 22, 2019, 11:19 a.m. OK Java 8 TESTS 37 109 0 1600
57469107 himanshubhardwaj169 D July 21, 2019, 5:08 p.m. OK Java 8 TESTS 37 109 0 1600
57449899 prem_cse D July 21, 2019, 9:23 a.m. OK Java 8 TESTS 37 109 0 1600
57443145 ZeyadKhattab D July 21, 2019, 7:24 a.m. OK Java 8 TESTS 37 109 0 1600
57423071 ViciousCoder D July 20, 2019, 7:10 p.m. OK Java 8 TESTS 37 109 0 1600
57422822 an09mous D July 20, 2019, 7:05 p.m. OK Java 8 TESTS 37 109 0 1600
57421452 kostasanemozalis D July 20, 2019, 6:49 p.m. OK Java 8 TESTS 37 109 0 1600
57411739 mongolrgata D July 20, 2019, 5:11 p.m. OK JavaScript TESTS 37 31 1024000 1600
57399467 amirrr D July 20, 2019, 4:15 p.m. OK Kotlin TESTS 37 140 0 1600
57434978 Spheniscine D July 21, 2019, 4:11 a.m. OK Kotlin TESTS 37 155 307200 1600
57435270 Spheniscine D July 21, 2019, 4:21 a.m. OK Kotlin TESTS 37 171 307200 1600
57623084 alex_t D July 24, 2019, 5:53 a.m. OK Kotlin TESTS 37 327 0 1600
57466970 og.kostya D July 21, 2019, 4 p.m. OK Mono C# TESTS 37 61 0 1600
57407709 omikad D July 20, 2019, 4:49 p.m. OK Mono C# TESTS 37 62 102400 1600
57407611 kuuso D July 20, 2019, 4:49 p.m. OK Mono C# TESTS 37 62 6656000 1600
57399997 eki D July 20, 2019, 4:16 p.m. OK Mono C# TESTS 37 77 102400 1600
57416568 sergmel D July 20, 2019, 5:41 p.m. OK Mono C# TESTS 37 77 3686400 1600
57403238 Yupiteru D July 20, 2019, 4:29 p.m. OK Mono C# TESTS 37 77 138240000 1600
58164006 vjudge4 D Aug. 2, 2019, 8:25 a.m. OK MS C++ TESTS 37 31 0 1600
58421982 vjudge5 D Aug. 7, 2019, 8:09 a.m. OK MS C++ TESTS 37 31 0 1600
61318884 vjudge4 D Sept. 26, 2019, 11:58 a.m. OK MS C++ TESTS 37 31 0 1600
57511425 vjudge4 D July 22, 2019, 1:57 p.m. OK MS C++ TESTS 37 31 0 1600
58686888 vjudge4 D Aug. 13, 2019, 12:24 a.m. OK MS C++ TESTS 37 31 0 1600
64100789 vjudge3 D Nov. 2, 2019, 3:23 p.m. OK MS C++ TESTS 37 31 0 1600
58421705 vjudge5 D Aug. 7, 2019, 8:02 a.m. OK MS C++ TESTS 37 31 102400 1600
58666234 vjudge4 D Aug. 12, 2019, 12:41 p.m. OK MS C++ TESTS 37 31 102400 1600
58686806 vjudge2 D Aug. 13, 2019, 12:20 a.m. OK MS C++ TESTS 37 31 512000 1600
58667808 vjudge1 D Aug. 12, 2019, 1:13 p.m. OK MS C++ TESTS 37 31 5222400 1600
57556273 hanna_d D July 22, 2019, 7:57 p.m. OK MS C++ 2017 TESTS 37 31 0 1600
62656295 YamagenSakam D Oct. 16, 2019, 1:57 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
61542876 vjudge3 D Sept. 30, 2019, 9:20 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
61324790 vjudge5 D Sept. 26, 2019, 1:32 p.m. OK MS C++ 2017 TESTS 37 31 0 1600
58806620 vjudge4 D Aug. 14, 2019, 9:10 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
58643791 vjudge4 D Aug. 12, 2019, 4:57 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
58488934 Yanhui Cuc-center HelloWorld1024 D Aug. 9, 2019, 8:49 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
58166198 vjudge1 D Aug. 2, 2019, 9:08 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
57489605 ZSTU-2018329621261 D July 22, 2019, 6:38 a.m. OK MS C++ 2017 TESTS 37 31 0 1600
57472726 omerb.zeybek D July 21, 2019, 7:08 p.m. OK MS C++ 2017 TESTS 37 31 0 1600
57422583 wolffd D July 20, 2019, 7:02 p.m. OK PyPy 2 TESTS 37 139 102400 1600
57462392 -Morass- D July 21, 2019, 2:12 p.m. OK PyPy 2 TESTS 37 139 307200 1600
57401311 c1729 D July 20, 2019, 4:21 p.m. OK PyPy 2 TESTS 37 140 716800 1600
57399484 aeternalis1 D July 20, 2019, 4:15 p.m. OK PyPy 2 TESTS 37 170 716800 1600
57402845 kabeer27 D July 20, 2019, 4:27 p.m. OK PyPy 2 TESTS 37 170 1433600 1600
57397343 bcollet D July 20, 2019, 4:08 p.m. OK PyPy 2 TESTS 37 170 1433600 1600
57398620 MathisHammel D July 20, 2019, 4:12 p.m. OK PyPy 2 TESTS 37 171 307200 1600
57409990 raj1307 D July 20, 2019, 5:01 p.m. OK PyPy 2 TESTS 37 171 1843200 1600
57402390 Pyar.Mahobat.Dhoka.Hai D July 20, 2019, 4:26 p.m. OK PyPy 2 TESTS 37 171 5222400 1600
59528296 yumtam D Aug. 26, 2019, 2:08 p.m. OK PyPy 2 TESTS 37 187 921600 1600
57614196 MyWorldRules D July 23, 2019, 11:58 p.m. OK PyPy 3 TESTS 37 140 1331200 1600
58915258 Vosatorp D Aug. 16, 2019, 2:42 p.m. OK PyPy 3 TESTS 37 140 1433600 1600
57418867 jakethekoenig D July 20, 2019, 5:56 p.m. OK PyPy 3 TESTS 37 140 1433600 1600
57400725 Boterphile D July 20, 2019, 4:19 p.m. OK PyPy 3 TESTS 37 140 1433600 1600
57442863 sybergeek D July 21, 2019, 7:19 a.m. OK PyPy 3 TESTS 37 140 2150400 1600
57434093 StinsonOvO D July 21, 2019, 3:36 a.m. OK PyPy 3 TESTS 37 140 2662400 1600
57414757 Honey_Badger D July 20, 2019, 5:29 p.m. OK PyPy 3 TESTS 37 140 2662400 1600
57556942 patrick_sliwinski D July 22, 2019, 8:24 p.m. OK PyPy 3 TESTS 37 155 0 1600
57407194 wilkinson D July 20, 2019, 4:47 p.m. OK PyPy 3 TESTS 37 155 0 1600
57417400 reireg D July 20, 2019, 5:47 p.m. OK PyPy 3 TESTS 37 155 1740800 1600
57422609 wolffd D July 20, 2019, 7:02 p.m. OK Python 2 TESTS 37 171 102400 1600
57422506 wolffd D July 20, 2019, 7:01 p.m. OK Python 2 TESTS 37 186 102400 1600
60545834 soumyasarkar1998 D Sept. 14, 2019, 1:41 p.m. OK Python 2 TESTS 37 202 0 1600
57502058 Helli.code D July 22, 2019, 10:36 a.m. OK Python 2 TESTS 37 202 102400 1600
57397199 nwi D July 20, 2019, 4:07 p.m. OK Python 2 TESTS 37 218 0 1600
58509950 frederick99 D Aug. 9, 2019, 6:25 p.m. OK Python 3 TESTS 37 109 0 1600
57415380 testingmyluck D July 20, 2019, 5:34 p.m. OK Python 3 TESTS 37 109 307200 1600
57953134 LintuStorm D July 29, 2019, 5:24 p.m. OK Python 3 TESTS 37 109 409600 1600
57946929 Babdus D July 29, 2019, 2:43 p.m. OK Python 3 TESTS 37 109 409600 1600
57813804 prmangal D July 26, 2019, 6:40 p.m. OK Python 3 TESTS 37 109 409600 1600
57485215 whatshisbucket D July 22, 2019, 4:56 a.m. OK Python 3 TESTS 37 109 409600 1600
57476821 julianferres D July 21, 2019, 10:29 p.m. OK Python 3 TESTS 37 109 409600 1600
57436134 akshat8171 D July 21, 2019, 4:51 a.m. OK Python 3 TESTS 37 109 409600 1600
69019643 nealzane D Jan. 18, 2020, 6:09 a.m. OK Python 3 TESTS 37 109 512000 1600
57618193 thisisgood D July 24, 2019, 2:52 a.m. OK Python 3 TESTS 37 109 512000 1600
57412725 rinzu D July 20, 2019, 5:17 p.m. OK Ruby TESTS 37 77 307200 1600
57405558 arzk D July 20, 2019, 4:39 p.m. OK Rust TESTS 37 31 0 1600
57404347 EbTech D July 20, 2019, 4:34 p.m. OK Rust TESTS 37 31 0 1600
57398754 tuna_salad D July 20, 2019, 4:12 p.m. OK Rust TESTS 37 31 0 1600
57409668 Leonardone D July 20, 2019, 4:59 p.m. OK Rust TESTS 37 46 0 1600
57399803 limed D July 20, 2019, 4:16 p.m. OK Scala TESTS 37 483 0 1600

remove filters

Back to search problems