Educational Codeforces Round 139 (Rated for 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
1766 Educational Codeforces Round 139 (Rated for Div. 2) FINISHED False 7200 66324263 Dec. 12, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 9206 ) D Lucky Chains PROGRAMMING brute force dp greedy math number theory

B"Let's name a pair of positive integers (x, y) lucky if the greatest common divisor of them is equal to 1 ( gcd(x, y) = 1 ). Let's define a chain induced by (x, y) as a sequence of pairs (x, y) , (x + 1, y + 1) , (x + 2, y + 2) , ... , (x + k, y + k) for some integer k ge 0 . The length of the chain is the number of pairs it consists of, or (k + 1) . Let's name such chain lucky if all pairs in the chain are lucky. You are given n pairs (x_i, y_i) . Calculate for each pair the length of the longest lucky chain induced by this pair. Note that if (x_i, y_i) is not lucky itself, the chain will have the length 0 . The first line contains a single integer n ( 1 <= n <= 10^6 ) -- the number of pairs. Next n lines contains n pairs -- one per line. The i -th line contains two integers x_i and y_i ( 1 <= x_i < y_i <= 10^7 ) -- the corresponding pair. Print n integers, where the i -th integer is the length of the longest lucky chain induced by (x_i, y_i) or -1 if the chain can be infinitely long. In the first test case, gcd(5, 15) = 5 > 1 , so it's already not lucky, so the length of the lucky chain is 0 . In the second test case, gcd(13 + 1, 37 + 1) = gcd(14, 38) = 2 . So, the lucky chain consists of the single pair (13, 37) . "...

Tutorials

110066

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
185004527 gxlois D Dec. 12, 2022, 7:38 p.m. OK GNU C11 TESTS 92 608 40140800
185133017 tokitsukaze D Dec. 14, 2022, 1:59 a.m. OK GNU C++14 TESTS 93 436 80281600
185133449 tokitsukaze D Dec. 14, 2022, 2:12 a.m. OK GNU C++14 TESTS 93 498 80281600
185133430 tokitsukaze D Dec. 14, 2022, 2:12 a.m. OK GNU C++14 TESTS 93 546 80281600
185133357 tokitsukaze D Dec. 14, 2022, 2:09 a.m. OK GNU C++14 TESTS 93 623 80281600
185071239 kfhkx D Dec. 13, 2022, 12:07 p.m. OK GNU C++14 TESTS 93 826 48128000
185020108 Ember520 D Dec. 13, 2022, 12:41 a.m. OK GNU C++14 TESTS 92 857 80179200
185078704 m1979823301m D Dec. 13, 2022, 1:13 p.m. OK GNU C++14 TESTS 93 889 44134400
185133699 lhzawa D Dec. 14, 2022, 2:20 a.m. OK GNU C++14 TESTS 93 904 42803200
185044659 Febleaf D Dec. 13, 2022, 7:51 a.m. OK GNU C++14 TESTS 92 904 46387200
185028026 53846 D Dec. 13, 2022, 3:44 a.m. OK GNU C++14 TESTS 92 919 46387200
185039243 wrihapcod D Dec. 13, 2022, 6:54 a.m. OK GNU C++17 TESTS 92 702 47513600
185101508 wangyzlsgj D Dec. 13, 2022, 4:25 p.m. OK GNU C++17 TESTS 93 904 80179200
185040343 qwertyyuu D Dec. 13, 2022, 7:05 a.m. OK GNU C++17 TESTS 92 904 90214400
185080913 Md._Nahid_Ullah_Joy D Dec. 13, 2022, 1:32 p.m. OK GNU C++17 TESTS 93 935 40038400
185084804 ymzymzymz D Dec. 13, 2022, 2:04 p.m. OK GNU C++17 TESTS 93 950 80179200
185020628 zja601 D Dec. 13, 2022, 12:57 a.m. OK GNU C++17 TESTS 92 951 46387200
185026254 DreamDimo D Dec. 13, 2022, 3:11 a.m. OK GNU C++17 TESTS 92 951 80179200
185080126 Md._Nahid_Ullah_Joy D Dec. 13, 2022, 1:25 p.m. OK GNU C++17 TESTS 93 966 40038400
185001466 Miracle25 D Dec. 12, 2022, 7:07 p.m. OK GNU C++17 TESTS 92 967 46387200
185064408 longk22 D Dec. 13, 2022, 11:05 a.m. OK GNU C++17 TESTS 93 967 46387200
185133042 tokitsukaze D Dec. 14, 2022, 2 a.m. OK GNU C++17 (64) TESTS 93 592 80281600
185129119 MoNasr D Dec. 13, 2022, 11:41 p.m. OK GNU C++17 (64) TESTS 93 686 56934400
185129088 MoNasr D Dec. 13, 2022, 11:39 p.m. OK GNU C++17 (64) TESTS 93 701 56934400
185128914 MoNasr D Dec. 13, 2022, 11:34 p.m. OK GNU C++17 (64) TESTS 93 748 56934400
185030443 Lycoriss D Dec. 13, 2022, 4:27 a.m. OK GNU C++17 (64) TESTS 92 764 80179200
185075923 DoTheBest_ZG D Dec. 13, 2022, 12:50 p.m. OK GNU C++17 (64) TESTS 93 780 47513600
185137571 Asuka12312 D Dec. 14, 2022, 4:02 a.m. OK GNU C++17 (64) TESTS 94 795 47513600
185108552 Secqin D Dec. 13, 2022, 5:25 p.m. OK GNU C++17 (64) TESTS 93 826 47513600
185019725 DuyAnhTM D Dec. 13, 2022, 12:29 a.m. OK GNU C++17 (64) TESTS 92 826 47513600
185108152 Secqin D Dec. 13, 2022, 5:22 p.m. OK GNU C++17 (64) TESTS 93 826 47513600
185017290 ulrich6 D Dec. 12, 2022, 11:06 p.m. OK GNU C++20 (64) TESTS 92 654 47513600
185031393 a575301453 D Dec. 13, 2022, 4:42 a.m. OK GNU C++20 (64) TESTS 92 654 80179200
185078847 jhc_123 D Dec. 13, 2022, 1:15 p.m. OK GNU C++20 (64) TESTS 93 655 47513600
185058572 atodo D Dec. 13, 2022, 10:07 a.m. OK GNU C++20 (64) TESTS 93 670 40140800
185123408 ikooo D Dec. 13, 2022, 9:12 p.m. OK GNU C++20 (64) TESTS 93 670 120217600
185050807 zech D Dec. 13, 2022, 8:56 a.m. OK GNU C++20 (64) TESTS 92 685 90521600
185080768 onlytrall D Dec. 13, 2022, 1:30 p.m. OK GNU C++20 (64) TESTS 93 686 40140800
185122616 ikooo D Dec. 13, 2022, 8:58 p.m. OK GNU C++20 (64) TESTS 93 686 47513600
185138848 mahirgupta1221 D Dec. 14, 2022, 4:29 a.m. OK GNU C++20 (64) TESTS 94 686 47513600
185021392 AkaiLemon D Dec. 13, 2022, 1:20 a.m. OK GNU C++20 (64) TESTS 92 686 80179200
185026238 pushkar.lonkar21 D Dec. 13, 2022, 3:11 a.m. OK Java 11 TESTS 92 967 48742400
185080013 x21svage D Dec. 13, 2022, 1:24 p.m. OK Java 11 TESTS 93 982 47820800
185082599 x21svage D Dec. 13, 2022, 1:46 p.m. OK Java 11 TESTS 93 982 47923200
185127916 hxu10 D Dec. 13, 2022, 11 p.m. OK Java 11 TESTS 93 1091 82841600
185025905 pushkar.lonkar21 D Dec. 13, 2022, 3:04 a.m. OK Java 11 TESTS 92 1138 48742400
185029364 qw_er__ty D Dec. 13, 2022, 4:08 a.m. OK Java 11 TESTS 92 1310 39936000
185128083 hxu10 D Dec. 13, 2022, 11:05 p.m. OK Java 11 TESTS 93 1356 82739200
185113446 dinosparton_013 D Dec. 13, 2022, 6:11 p.m. OK Java 11 TESTS 93 1466 82534400
185064143 Jackyjuman D Dec. 13, 2022, 11:03 a.m. OK Java 11 TESTS 93 1528 53248000
185096260 vermadv2000 D Dec. 13, 2022, 3:40 p.m. OK Java 11 TESTS 93 1543 39731200
185110380 manasrai1234567 D Dec. 13, 2022, 5:42 p.m. OK Java 17 TESTS 93 950 49356800
185060961 Adar8604 D Dec. 13, 2022, 10:31 a.m. OK Java 17 TESTS 93 951 54784000
185109057 testing_47 D Dec. 13, 2022, 5:29 p.m. OK Java 17 TESTS 93 982 49356800
185056686 frey4 D Dec. 13, 2022, 9:49 a.m. OK Java 17 TESTS 93 1388 41676800
185055953 frey4 D Dec. 13, 2022, 9:41 a.m. OK Java 17 TESTS 93 1450 41676800
185021966 uwuenvy D Dec. 13, 2022, 1:35 a.m. OK Java 17 TESTS 92 1669 41369600
185070587 testing_47 D Dec. 13, 2022, 12:01 p.m. OK Java 8 TESTS 93 873 58777600
185067368 dingmingcheng D Dec. 13, 2022, 11:32 a.m. OK Java 8 TESTS 93 1029 90214400
185067189 dingmingcheng D Dec. 13, 2022, 11:30 a.m. OK Java 8 TESTS 93 1045 38502400
185020451 omeganot D Dec. 13, 2022, 12:52 a.m. OK Java 8 TESTS 92 1325 115097600
185047089 back2lyfe D Dec. 13, 2022, 8:24 a.m. OK Java 8 TESTS 92 1372 94310400
185061587 sachinjaiswal D Dec. 13, 2022, 10:38 a.m. OK Java 8 TESTS 93 1544 38502400
185097434 vaibhav_1710 D Dec. 13, 2022, 3:50 p.m. OK Java 8 TESTS 93 1653 78643200
185019290 ikillmyself D Dec. 13, 2022, 12:13 a.m. OK Java 8 TESTS 92 2573 0
185078263 Juhaied_nabid D Dec. 13, 2022, 1:10 p.m. OK Java 8 TESTS 93 2588 0
185050347 khan1121 D Dec. 13, 2022, 8:52 a.m. OK Java 8 TESTS 92 2917 38502400
185024831 bpdolson D Dec. 13, 2022, 2:43 a.m. OK PyPy 3 TESTS 92 1700 125747200
185109460 hxu10 D Dec. 13, 2022, 5:33 p.m. OK PyPy 3 TESTS 93 2105 125644800
185026274 rajeshpenugonda6 D Dec. 13, 2022, 3:12 a.m. OK PyPy 3 TESTS 92 2464 205209600
185028548 hxu10 D Dec. 13, 2022, 3:54 a.m. OK PyPy 3 TESTS 92 3993 57344000
185025128 baluteshih D Dec. 13, 2022, 2:50 a.m. OK PyPy 3-64 TESTS 92 1294 214220800
185022785 rien D Dec. 13, 2022, 1:55 a.m. OK PyPy 3-64 TESTS 92 1482 137932800
185022719 rien D Dec. 13, 2022, 1:53 a.m. OK PyPy 3-64 TESTS 92 1497 138035200
185073872 Whyush D Dec. 13, 2022, 12:31 p.m. OK PyPy 3-64 TESTS 93 1528 127795200
185106589 _N_0_0_B_ D Dec. 13, 2022, 5:09 p.m. OK PyPy 3-64 TESTS 93 1575 134656000
185001976 KanishkGoel D Dec. 12, 2022, 7:11 p.m. OK PyPy 3-64 TESTS 92 1575 171315200
185010258 ossau_guildo D Dec. 12, 2022, 8:49 p.m. OK PyPy 3-64 TESTS 92 1575 184627200
185014528 onemoreq D Dec. 12, 2022, 9:57 p.m. OK PyPy 3-64 TESTS 92 1621 215040000
185106937 _N_0_0_B_ D Dec. 13, 2022, 5:12 p.m. OK PyPy 3-64 TESTS 93 1638 134656000
185002711 KanishkGoel D Dec. 12, 2022, 7:18 p.m. OK PyPy 3-64 TESTS 92 1638 171520000
185049312 Spheniscine D Dec. 13, 2022, 8:44 a.m. OK Rust 2021 TESTS 92 499 20172800
185064391 Spheniscine D Dec. 13, 2022, 11:05 a.m. OK Rust 2021 TESTS 93 514 20172800
185088857 robostac D Dec. 13, 2022, 2:38 p.m. OK Rust 2021 TESTS 93 546 93900800
185091370 robostac D Dec. 13, 2022, 2:59 p.m. OK Rust 2021 TESTS 93 592 53760000
185082853 Sempr D Dec. 13, 2022, 1:48 p.m. OK Rust 2021 TESTS 93 654 54681600
185082690 Sempr D Dec. 13, 2022, 1:47 p.m. OK Rust 2021 TESTS 93 670 54681600
185082232 Sempr D Dec. 13, 2022, 1:43 p.m. OK Rust 2021 TESTS 93 670 54784000
185083372 Sempr D Dec. 13, 2022, 1:52 p.m. OK Rust 2021 TESTS 93 686 54681600
185081924 Sempr D Dec. 13, 2022, 1:41 p.m. OK Rust 2021 TESTS 93 717 74752000
185020274 liut D Dec. 13, 2022, 12:46 a.m. OK Rust 2021 TESTS 92 748 93798400

remove filters

Back to search problems