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 |
---|---|---|---|---|---|---|
516 | Codeforces Round 292 (Div. 1) | FINISHED | False | 7200 | 307632299 | Feb. 17, 2015, 4:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 505 ) | E | Drazil and His Happy Friends | PROGRAMMING | math number theory | 3000 |
B"Drazil has many friends. Some of them are happy and some of them are unhappy. Drazil wants to make all his friends become happy. So he invented the following plan. There are n boys and m girls among his friends. Let's number them from 0 to n xe2 x80 x89- xe2 x80 x891 and 0 to m xe2 x80 x89- xe2 x80 x891 separately. In i-th day, Drazil invites -th boy and -th girl to have dinner together (as Drazil is programmer, i starts from 0). If one of those two people is happy, the other one will also become happy. Otherwise, those two people remain in their states. Once a person becomes happy (or if it is happy originally), he stays happy forever. Drazil wants to know on which day all his friends become happy or to determine if they won't become all happy at all. The first line contains two integer n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109). The second line contains integer b (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89b xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89min(n, xe2 x80 x89105)), denoting the number of happy boys among friends of Drazil, and then follow b distinct integers x1, xe2 x80 x89x2, xe2 x80 x89..., xe2 x80 x89xb (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89xi xe2 x80 x89< xe2 x80 x89n), denoting the list of indices of happy boys. The third line conatins integer g (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89g xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89min(m, xe2 x80 x89105)), denoting the number of happy girls among friends of Drazil, and then follow g distinct integers y1, xe2 x80 x89y2, xe2 x80 x89... , xe2 x80 x89yg (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89yj xe2 x80 x89< xe2 x80 x89m), denoting the list of indices of happy girls. It is guaranteed that there is at least one person that is unhappy among his friends. Print the number of the first day that all friends of Drazil become happy. If this day won't come at all, you print -1. By we define the remainder of integer division of i by k. In first sample case: "... |
16468 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
9904181 | hos.lyric | E | Feb. 17, 2015, 7:19 p.m. | OK | D | TESTS | 60 | 2745 | 22323200 | 3000 | |
9905730 | mirecek3 | E | Feb. 17, 2015, 8:06 p.m. | OK | GNU C | TESTS | 60 | 186 | 6451200 | 3000 | |
9950006 | surabhi.shrivastav | E | Feb. 21, 2015, 3:58 p.m. | OK | GNU C | TESTS | 60 | 187 | 6451200 | 3000 | |
11338161 | Amr_Hassan | E | May 28, 2015, 7:33 p.m. | OK | GNU C++ | TESTS | 60 | 93 | 22835200 | 3000 | |
9916295 | DAada | E | Feb. 18, 2015, 3:38 p.m. | OK | GNU C++ | TESTS | 60 | 93 | 22835200 | 3000 | |
9916283 | DAada | E | Feb. 18, 2015, 3:37 p.m. | OK | GNU C++ | TESTS | 60 | 93 | 22835200 | 3000 | |
29242906 | Scut82 | E | Aug. 6, 2017, 1:54 p.m. | OK | GNU C++ | TESTS | 60 | 93 | 26214400 | 3000 | |
40986991 | ReaLNero1 | E | July 30, 2018, 8:53 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 22835200 | 3000 | |
14416112 | _LongLeg_ | E | Nov. 22, 2015, 3:40 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 22835200 | 3000 | |
10033501 | nikacimakuridze | E | Feb. 26, 2015, 2:27 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 22835200 | 3000 | |
9972163 | sheri.mori | E | Feb. 23, 2015, 5:55 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 22835200 | 3000 | |
9897098 | rng_58 | E | Feb. 17, 2015, 5:43 p.m. | OK | GNU C++ | TESTS | 60 | 109 | 22835200 | 3000 | |
16280250 | aid | E | Feb. 22, 2016, 4:22 p.m. | OK | GNU C++ | TESTS | 60 | 171 | 12185600 | 3000 | |
9919136 | vepifanov | E | Feb. 18, 2015, 7:47 p.m. | OK | GNU C++0x | TESTS | 60 | 140 | 15052800 | 3000 | |
9964790 | worst_coder | E | Feb. 23, 2015, 2:09 a.m. | OK | GNU C++0x | TESTS | 60 | 202 | 5632000 | 3000 | |
9959099 | pooyan10000 | E | Feb. 22, 2015, 12:07 p.m. | OK | GNU C++0x | TESTS | 60 | 202 | 5632000 | 3000 | |
10147268 | Manul | E | March 4, 2015, 1:03 p.m. | OK | GNU C++0x | TESTS | 60 | 233 | 24576000 | 3000 | |
10347297 | WoodcutKnife | E | March 19, 2015, 10:01 a.m. | OK | GNU C++0x | TESTS | 60 | 374 | 12697600 | 3000 | |
9972091 | dreamoon_love_AA | E | Feb. 23, 2015, 5:49 p.m. | OK | GNU C++0x | TESTS | 60 | 670 | 22937600 | 3000 | |
9975320 | danielfleischman | E | Feb. 24, 2015, 12:42 a.m. | OK | GNU C++0x | TESTS | 60 | 1014 | 9011200 | 3000 | |
10090114 | b0mb3r | E | Feb. 28, 2015, 11:42 p.m. | OK | GNU C++0x | TESTS | 60 | 2230 | 79462400 | 3000 | |
10061307 | b0mb3r | E | Feb. 28, 2015, 8:24 a.m. | OK | GNU C++0x | TESTS | 60 | 2402 | 79462400 | 3000 | |
10061347 | b0mb3r | E | Feb. 28, 2015, 8:29 a.m. | OK | GNU C++0x | TESTS | 60 | 2433 | 79462400 | 3000 | |
64498532 | _rqy | E | Nov. 8, 2019, 2:23 a.m. | OK | GNU C++11 | TESTS | 60 | 62 | 7372800 | 3000 | |
66589699 | Jayce132 | E | Dec. 10, 2019, 12:32 p.m. | OK | GNU C++11 | TESTS | 60 | 62 | 12492800 | 3000 | |
64340619 | cly_none | E | Nov. 6, 2019, 2:22 a.m. | OK | GNU C++11 | TESTS | 60 | 62 | 18329600 | 3000 | |
10994627 | K_D_M | E | May 4, 2015, 10:51 a.m. | OK | GNU C++11 | TESTS | 60 | 93 | 22835200 | 3000 | |
10518730 | fenzhang | E | March 29, 2015, 5:54 p.m. | OK | GNU C++11 | TESTS | 60 | 124 | 9011200 | 3000 | |
63071801 | luogu_bot4 | E | Oct. 21, 2019, 12:36 p.m. | OK | GNU C++11 | TESTS | 60 | 124 | 9113600 | 3000 | |
10518341 | fenzhang | E | March 29, 2015, 5:20 p.m. | OK | GNU C++11 | TESTS | 60 | 124 | 9830400 | 3000 | |
68484214 | Saber__ | E | Jan. 10, 2020, 9:01 a.m. | OK | GNU C++11 | TESTS | 60 | 124 | 11571200 | 3000 | |
67636865 | ProgSlacking | E | Dec. 26, 2019, 7:28 a.m. | OK | GNU C++11 | TESTS | 60 | 124 | 13312000 | 3000 | |
67636807 | ProgSlacking | E | Dec. 26, 2019, 7:25 a.m. | OK | GNU C++11 | TESTS | 60 | 124 | 13312000 | 3000 | |
68422984 | lyx_cjz | E | Jan. 9, 2020, 12:26 a.m. | OK | GNU C++14 | TESTS | 60 | 93 | 8806400 | 3000 | |
23664681 | saliii | E | Jan. 9, 2017, 9:05 a.m. | OK | GNU C++14 | TESTS | 60 | 108 | 9113600 | 3000 | |
69568909 | rushcheyo | E | Jan. 26, 2020, 1:26 p.m. | OK | GNU C++14 | TESTS | 60 | 108 | 9523200 | 3000 | |
55916169 | zhou888 | E | June 22, 2019, 5:32 a.m. | OK | GNU C++14 | TESTS | 60 | 109 | 14540800 | 3000 | |
58689378 | Scut82 | E | Aug. 13, 2019, 2:16 a.m. | OK | GNU C++14 | TESTS | 60 | 109 | 23449600 | 3000 | |
37210368 | AwD | E | April 11, 2018, 8:15 a.m. | OK | GNU C++14 | TESTS | 60 | 124 | 12697600 | 3000 | |
50782354 | bestFy | E | March 4, 2019, 11:58 a.m. | OK | GNU C++14 | TESTS | 60 | 139 | 7065600 | 3000 | |
69408579 | AprilGrimoire | E | Jan. 23, 2020, 11:48 a.m. | OK | GNU C++14 | TESTS | 60 | 139 | 10956800 | 3000 | |
64341156 | cz_xuyixuan | E | Nov. 6, 2019, 2:49 a.m. | OK | GNU C++14 | TESTS | 60 | 171 | 9113600 | 3000 | |
42458395 | jhdjames37 | E | Sept. 4, 2018, 12:35 p.m. | OK | GNU C++14 | TESTS | 60 | 171 | 13004800 | 3000 | |
68653485 | xymtxdy | E | Jan. 12, 2020, 11:30 a.m. | OK | GNU C++17 | TESTS | 60 | 78 | 8806400 | 3000 | |
69288624 | CMXRYNP | E | Jan. 22, 2020, 9:16 a.m. | OK | GNU C++17 | TESTS | 60 | 78 | 9523200 | 3000 | |
69286100 | CMXRYNP | E | Jan. 22, 2020, 8:15 a.m. | OK | GNU C++17 | TESTS | 60 | 108 | 9523200 | 3000 | |
69287642 | CMXRYNP | E | Jan. 22, 2020, 8:53 a.m. | OK | GNU C++17 | TESTS | 60 | 109 | 9523200 | 3000 | |
46298613 | Shayan.P | E | Nov. 28, 2018, 5:48 a.m. | OK | GNU C++17 | TESTS | 60 | 124 | 10854400 | 3000 | |
62840328 | wucstdio | E | Oct. 18, 2019, 2:14 a.m. | OK | GNU C++17 | TESTS | 60 | 155 | 9216000 | 3000 | |
68070847 | tEMMIE.w. | E | Jan. 2, 2020, 10:12 a.m. | OK | GNU C++17 | TESTS | 60 | 156 | 11571200 | 3000 | |
65744319 | Fulisike | E | Nov. 26, 2019, 11:38 a.m. | OK | GNU C++17 | TESTS | 60 | 171 | 23449600 | 3000 | |
67257529 | Zhou_JK | E | Dec. 20, 2019, 12:05 a.m. | OK | GNU C++17 | TESTS | 60 | 186 | 19558400 | 3000 | |
67267843 | vjudge2 | E | Dec. 20, 2019, 6:55 a.m. | OK | GNU C++17 | TESTS | 60 | 187 | 19558400 | 3000 | |
44169866 | tri | E | Oct. 12, 2018, 4:54 a.m. | OK | Java 8 | TESTS | 60 | 1746 | 50790400 | 3000 | |
9938274 | Los_Angelos_Laycurse | E | Feb. 20, 2015, 2:29 p.m. | OK | MS C++ | TESTS | 60 | 3463 | 7884800 | 3000 |
Back to search problems