Codeforces Round 166 (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
271 Codeforces Round 166 (Div. 2) FINISHED False 7200 415809023 Feb. 11, 2013, 3:30 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 597 ) E Three Horses PROGRAMMING constructive algorithms math number theory 2500

There are three horses living in a horse land: one gray, one white and one gray-and-white. The horses are really amusing animals, which is why they adore special cards. Each of those cards must contain two integers, the first one on top, the second one in the bottom of the card. Let's denote a card with a on the top and b in the bottom as ( a , b ) . Each of the three horses can paint the special cards. If you show an ( a , b ) card to the gray horse, then the horse can paint a new ( a + 1, b + 1) card. If you show an ( a , b ) card, such that a and b are even integers, to the white horse, then the horse can paint a new card. If you show two cards ( a , b ) and ( b , c ) to the gray-and-white horse, then he can paint a new ( a , c ) card. Polycarpus really wants to get n special cards (1, a 1 ) , (1, a 2 ) , ... , (1, a n ) . For that he is going to the horse land. He can take exactly one ( x , y ) card to the horse land, such that 1 ≤ x < y ≤ m . How many ways are there to choose the card so that he can perform some actions in the horse land and get the required cards? Polycarpus can get cards from the horses only as a result of the actions that are described above. Polycarpus is allowed to get additional cards besides the cards that he requires. The first line contains two integers n , m (1 ≤ n ≤ 10 5 , 2 ≤ m ≤ 10 9 ) . The second line contains the sequence of integers a 1 , a 2 , ..., a n (2 ≤ a i ≤ 10 9 ) . Note, that the numbers in the sequence can coincide. The numbers in the lines are separated by single spaces. Print a single integer — the answer to the problem. Please, do not use the %lld specifier to read or write 64-bit integers in C++ . It is preferred to use the cin , cout streams or the %I64d specifier.

Tutorials

6662

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
27579041 infinity37 E June 5, 2017, 8:56 a.m. OK GNU C++ TESTS 31 62 0 2500
40990220 ReaLNero1 E July 30, 2018, 11:43 p.m. OK GNU C++ TESTS 31 62 614400 2500
35336282 vjudge4 E Feb. 16, 2018, 12:09 p.m. OK GNU C++ TESTS 31 62 2150400 2500
28725820 Scut82 E July 20, 2017, 1:10 p.m. OK GNU C++ TESTS 31 62 2150400 2500
35475449 vjudge3 E Feb. 19, 2018, 3:48 p.m. OK GNU C++ TESTS 31 62 2457600 2500
35222112 vjudge3 E Feb. 14, 2018, 3:02 a.m. OK GNU C++ TESTS 31 62 2457600 2500
35422014 vjudge5 E Feb. 17, 2018, 3:11 p.m. OK GNU C++ TESTS 31 62 2867200 2500
36113385 vjudge2 E March 9, 2018, 11:09 a.m. OK GNU C++ TESTS 31 62 6246400 2500
35222091 vjudge5 E Feb. 14, 2018, 2:57 a.m. OK GNU C++ TESTS 31 92 2457600 2500
63039661 Dread.t E Oct. 20, 2019, 11:26 p.m. OK GNU C++11 TESTS 31 62 0 2500
35383736 andwho E Feb. 17, 2018, 6:37 a.m. OK GNU C++11 TESTS 31 62 2048000 2500
35336471 hongzhiyin E Feb. 16, 2018, 12:16 p.m. OK GNU C++11 TESTS 31 62 2048000 2500
35475417 Sodaine E Feb. 19, 2018, 3:47 p.m. OK GNU C++11 TESTS 31 62 2457600 2500
35383652 andwho E Feb. 17, 2018, 6:32 a.m. OK GNU C++11 TESTS 31 62 2457600 2500
35383633 andwho E Feb. 17, 2018, 6:30 a.m. OK GNU C++11 TESTS 31 62 2457600 2500
35222137 vjudge5 E Feb. 14, 2018, 3:08 a.m. OK GNU C++11 TESTS 31 62 15872000 2500
68836833 luogu_bot5 E Jan. 15, 2020, 3:42 a.m. OK GNU C++11 TESTS 31 92 0 2500
48096296 NRK7 E Jan. 8, 2019, 5:03 p.m. OK GNU C++11 TESTS 31 92 0 2500
45670763 Sherek E Nov. 13, 2018, 10:31 a.m. OK GNU C++11 TESTS 31 92 0 2500
35383756 vjudge4 E Feb. 17, 2018, 6:38 a.m. OK GNU C++14 TESTS 31 62 1945600 2500
34593462 sourabh23 E Jan. 27, 2018, 4:18 a.m. OK GNU C++14 TESTS 31 62 2355200 2500
48177341 NoCodeNoLife E Jan. 10, 2019, 10:23 a.m. OK GNU C++14 TESTS 31 92 0 2500
67953128 mota_haathi E Dec. 30, 2019, 8:31 a.m. OK GNU C++14 TESTS 31 92 102400 2500
49858794 anjn98 E Feb. 13, 2019, 8:30 a.m. OK GNU C++14 TESTS 31 92 102400 2500
46917052 brimix__ E Dec. 11, 2018, 9:40 p.m. OK GNU C++14 TESTS 31 92 204800 2500
46930937 pikmike E Dec. 12, 2018, 11:36 a.m. OK GNU C++14 TESTS 31 92 409600 2500
45268418 adedalic E Nov. 4, 2018, 7:14 a.m. OK GNU C++14 TESTS 31 92 512000 2500
49523843 Sorting E Feb. 6, 2019, 10 a.m. OK GNU C++14 TESTS 31 92 819200 2500
33894121 mjhun E Jan. 3, 2018, 11:13 p.m. OK GNU C++14 TESTS 31 92 1843200 2500
51845734 ruo E March 26, 2019, 4:24 a.m. OK GNU C++17 TESTS 31 92 0 2500
49746498 ivanilos E Feb. 10, 2019, 10:04 p.m. OK GNU C++17 TESTS 31 92 0 2500
52582502 markotee E April 10, 2019, 8:09 p.m. OK GNU C++17 TESTS 31 92 102400 2500
45473394 sinus_070 E Nov. 9, 2018, 11:14 a.m. OK GNU C++17 TESTS 31 92 204800 2500
49178713 majk E Jan. 29, 2019, 11:07 p.m. OK GNU C++17 TESTS 31 92 614400 2500
40532207 TuGSGeReL E July 19, 2018, 3:40 a.m. OK GNU C++17 TESTS 31 92 921600 2500
47277714 Hiasat E Dec. 19, 2018, 8:31 p.m. OK GNU C++17 TESTS 31 92 1126400 2500
41319987 cai_lw E Aug. 8, 2018, 12:01 a.m. OK GNU C++17 TESTS 31 122 0 2500
44925423 SendThemToHell E Oct. 26, 2018, 7:52 p.m. OK GNU C++17 TESTS 31 122 102400 2500
57310963 karansiwach360 E July 19, 2019, 6:27 a.m. OK GNU C++17 TESTS 31 122 409600 2500
62173922 Ahmad E Oct. 9, 2019, 2:52 a.m. OK Java 8 TESTS 31 218 0 2500
67748880 teru E Dec. 27, 2019, 5:14 p.m. OK Mono C# TESTS 31 186 17612800 2500
35856572 ______u______ E March 2, 2018, 8:22 p.m. OK Python 2 TESTS 31 436 12288000 2500
35856520 ______n______ E March 2, 2018, 8:22 p.m. OK Python 2 TESTS 31 436 12288000 2500
35855988 _____i_____ E March 2, 2018, 8:12 p.m. OK Python 2 TESTS 31 436 12288000 2500
35855964 _____k_____ E March 2, 2018, 8:11 p.m. OK Python 2 TESTS 31 436 12288000 2500
35847127 ______k______ E March 2, 2018, 4:39 p.m. OK Python 2 TESTS 31 436 12288000 2500
35847123 ______h______ E March 2, 2018, 4:39 p.m. OK Python 2 TESTS 31 436 12288000 2500
35844445 ______i______ E March 2, 2018, 3:30 p.m. OK Python 2 TESTS 31 436 12288000 2500
35842267 ______M______ E March 2, 2018, 2:49 p.m. OK Python 2 TESTS 31 436 12288000 2500

remove filters

Back to search problems