Codeforces Round 704 (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
1492 Codeforces Round 704 (Div. 2) FINISHED False 7200 117752099 Feb. 23, 2021, 9:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 22704 ) A Three swimmers PROGRAMMING math

B'Three swimmers decided to organize a party in the swimming pool! At noon, they started to swim from the left side of the pool. It takes the first swimmer exactly a minutes to swim across the entire pool and come back, exactly b minutes for the second swimmer and c minutes for the third. Hence, the first swimmer will be on the left side of the pool after 0 , a , 2a , 3a , ... minutes after the start time, the second one will be at 0 , b , 2b , 3b , ... minutes, and the third one will be on the left side of the pool after 0 , c , 2c , 3c , ... minutes. You came to the left side of the pool exactly p minutes after they started swimming. Determine how long you have to wait before one of the swimmers arrives at the left side of the pool. The first line of the input contains a single integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. Next t lines contains test case descriptions, one per line. Each line contains four integers p , a , b and c ( 1 <= q p, a, b, c <= q 10^{18} ), time in minutes after the start, when you came to the pool and times in minutes it take the swimmers to cross the entire pool and come back. For each test case, output one integer -- how long you have to wait (in minutes) before one of the swimmers arrives at the left side of the pool. In the first test case, the first swimmer is on the left side in 0, 5, 10, 15, ldots minutes after the start time, the second swimmer is on the left side in 0, 4, 8, 12, ldots minutes after the start time, and the third swimmer is on the left side in 0, 8, 16, 24, ldots minutes after the start time. You arrived at the pool in 9 minutes after the start time and in a minute you will meet the first swimmer on the left side. In the second test case, the first swimmer is on the left side in 0, 6, 12, 18, ldots minutes after the start time, th'...

Tutorials

Codeforces Round #704 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
108362444 qdnoip A Feb. 24, 2021, 5:57 a.m. OK Clang++17 Diagnostics TESTS 48 46 0
108362584 qdnoip A Feb. 24, 2021, 5:59 a.m. OK Clang++17 Diagnostics TESTS 48 46 0
108326089 gslee A Feb. 23, 2021, 4:51 p.m. OK Clang++17 Diagnostics TESTS 45 77 0
108351119 ndocx A Feb. 24, 2021, 3:01 a.m. OK FPC TESTS 47 31 102400
108314262 chen01 A Feb. 23, 2021, 3:02 p.m. OK GNU C11 TESTS 45 15 0
108323760 ronweasley07 A Feb. 23, 2021, 4:39 p.m. OK GNU C11 TESTS 45 15 0
108329676 CastleBravo A Feb. 23, 2021, 5:18 p.m. OK GNU C11 TESTS 45 15 0
108355704 Aarush.zxd A Feb. 24, 2021, 4:39 a.m. OK GNU C11 TESTS 48 15 0
108314203 chen01 A Feb. 23, 2021, 3:01 p.m. OK GNU C11 TESTS 45 15 0
108346086 whistle0120 A Feb. 24, 2021, 12:21 a.m. OK GNU C11 TESTS 46 30 0
108334924 pratyushg20 A Feb. 23, 2021, 6:31 p.m. OK GNU C11 TESTS 46 30 0
108348025 venom14 A Feb. 24, 2021, 1:35 a.m. OK GNU C11 TESTS 46 30 0
108315604 manish_1605 A Feb. 23, 2021, 3:14 p.m. OK GNU C11 TESTS 45 31 0
108312482 tronifier A Feb. 23, 2021, 2:46 p.m. OK GNU C11 TESTS 45 31 0
108355557 Kobe303 A Feb. 24, 2021, 4:37 a.m. OK GNU C++11 TESTS 48 15 0
108362046 qdnoip A Feb. 24, 2021, 5:53 a.m. OK GNU C++11 TESTS 48 15 0
108361044 qdnoip A Feb. 24, 2021, 5:43 a.m. OK GNU C++11 TESTS 48 15 0
108360671 jafor_iqbal A Feb. 24, 2021, 5:39 a.m. OK GNU C++11 TESTS 48 15 0
108359884 mazihang2022 A Feb. 24, 2021, 5:31 a.m. OK GNU C++11 TESTS 48 15 0
108357540 Leasier A Feb. 24, 2021, 5:04 a.m. OK GNU C++11 TESTS 48 15 0
108355725 rui_er A Feb. 24, 2021, 4:40 a.m. OK GNU C++11 TESTS 48 15 0
108353307 wjxtrl A Feb. 24, 2021, 3:54 a.m. OK GNU C++11 TESTS 47 15 0
108352996 noone___ A Feb. 24, 2021, 3:47 a.m. OK GNU C++11 TESTS 47 15 0
108352955 rmnjtiwari A Feb. 24, 2021, 3:46 a.m. OK GNU C++11 TESTS 47 15 0
108334156 cicada2020 A Feb. 23, 2021, 6:20 p.m. OK GNU C++14 TESTS 46 15 0
108335567 pppiyushh A Feb. 23, 2021, 6:42 p.m. OK GNU C++14 TESTS 46 30 0
108336615 Adist319 A Feb. 23, 2021, 6:59 p.m. OK GNU C++14 TESTS 46 30 0
108347895 Chaturvedi07 A Feb. 24, 2021, 1:31 a.m. OK GNU C++14 TESTS 46 30 0
108352410 k_ayushh A Feb. 24, 2021, 3:32 a.m. OK GNU C++14 TESTS 47 30 0
108354260 sid2710 A Feb. 24, 2021, 4:14 a.m. OK GNU C++14 TESTS 48 30 0
108355065 sahil903 A Feb. 24, 2021, 4:30 a.m. OK GNU C++14 TESTS 48 30 0
108357158 doneit A Feb. 24, 2021, 4:59 a.m. OK GNU C++14 TESTS 48 30 0
108357855 Agni_123 A Feb. 24, 2021, 5:08 a.m. OK GNU C++14 TESTS 48 30 0
108358015 Nabil28 A Feb. 24, 2021, 5:09 a.m. OK GNU C++14 TESTS 48 30 0
108300976 iakshit1999 A Feb. 23, 2021, 1:11 p.m. OK GNU C++17 TESTS 45 15 0
108360137 qdnoip A Feb. 24, 2021, 5:34 a.m. OK GNU C++17 TESTS 48 15 0
108351398 ritik_birla A Feb. 24, 2021, 3:08 a.m. OK GNU C++17 TESTS 47 15 0
108344813 robert.chinem A Feb. 23, 2021, 11:06 p.m. OK GNU C++17 TESTS 46 15 0
108339265 mohiit.singh600 A Feb. 23, 2021, 7:51 p.m. OK GNU C++17 TESTS 46 15 0
108315622 aman_464 A Feb. 23, 2021, 3:14 p.m. OK GNU C++17 TESTS 45 15 0
108312410 venkatkiran A Feb. 23, 2021, 2:45 p.m. OK GNU C++17 TESTS 45 15 0
108303564 Zaini_02 A Feb. 23, 2021, 1:29 p.m. OK GNU C++17 TESTS 45 15 0
108302990 GoodFella A Feb. 23, 2021, 1:25 p.m. OK GNU C++17 TESTS 45 15 0
108305393 vaibhavbht A Feb. 23, 2021, 1:43 p.m. OK GNU C++17 TESTS 45 15 1024000
108312602 adarshmishra A Feb. 23, 2021, 2:47 p.m. OK GNU C++17 (64) TESTS 45 15 0
108305660 tysm A Feb. 23, 2021, 1:45 p.m. OK GNU C++17 (64) TESTS 45 15 0
108361090 novice166 A Feb. 24, 2021, 5:43 a.m. OK GNU C++17 (64) TESTS 48 15 0
108358950 DarkCavalier A Feb. 24, 2021, 5:20 a.m. OK GNU C++17 (64) TESTS 48 15 0
108346637 jainbot27 A Feb. 24, 2021, 12:45 a.m. OK GNU C++17 (64) TESTS 46 15 0
108328626 Zaak22 A Feb. 23, 2021, 5:06 p.m. OK GNU C++17 (64) TESTS 45 15 0
108323209 SSYernar A Feb. 23, 2021, 4:33 p.m. OK GNU C++17 (64) TESTS 45 15 0
108301246 _Stack_2.0_ A Feb. 23, 2021, 1:12 p.m. OK GNU C++17 (64) TESTS 45 15 0
108314349 lycan07 A Feb. 23, 2021, 3:03 p.m. OK GNU C++17 (64) TESTS 45 15 0
108316174 ILSM A Feb. 23, 2021, 3:19 p.m. OK GNU C++17 (64) TESTS 45 15 0
108362476 verysmartkid A Feb. 24, 2021, 5:58 a.m. OK Java 11 TESTS 48 171 0
108351587 zhupeijun A Feb. 24, 2021, 3:12 a.m. OK Java 11 TESTS 47 171 0
108340769 shankha123 A Feb. 23, 2021, 8:27 p.m. OK Java 11 TESTS 46 171 0
108337780 mennafadali A Feb. 23, 2021, 7:19 p.m. OK Java 11 TESTS 46 171 0
108318788 Nick A Feb. 23, 2021, 3:46 p.m. OK Java 11 TESTS 45 171 0
108316728 adhi_2311 A Feb. 23, 2021, 3:25 p.m. OK Java 11 TESTS 45 171 0
108314150 gssakash A Feb. 23, 2021, 3 p.m. OK Java 11 TESTS 45 171 0
108306819 godfather9 A Feb. 23, 2021, 1:55 p.m. OK Java 11 TESTS 45 171 0
108304543 Tharun0102 A Feb. 23, 2021, 1:37 p.m. OK Java 11 TESTS 45 171 0
108357892 Divy_Chavda A Feb. 24, 2021, 5:08 a.m. OK Java 11 TESTS 48 186 0
108304427 Abdallah_Ragab00 A Feb. 23, 2021, 1:36 p.m. OK Java 8 TESTS 45 109 0
108304581 InANutshell A Feb. 23, 2021, 1:37 p.m. OK Java 8 TESTS 45 109 0
108317719 Tourist_ka_baap777 A Feb. 23, 2021, 3:35 p.m. OK Java 8 TESTS 45 109 0
108352294 Pranay_ A Feb. 24, 2021, 3:29 a.m. OK Java 8 TESTS 47 109 0
108333956 RonWonWon A Feb. 23, 2021, 6:17 p.m. OK Java 8 TESTS 46 109 0
108323168 Zatona A Feb. 23, 2021, 4:33 p.m. OK Java 8 TESTS 45 109 0
108339835 mkosm A Feb. 23, 2021, 8:03 p.m. OK Java 8 TESTS 46 124 0
108358025 lucas.joel.han A Feb. 24, 2021, 5:10 a.m. OK Java 8 TESTS 48 124 0
108347352 dom0619 A Feb. 24, 2021, 1:12 a.m. OK Java 8 TESTS 46 124 0
108342722 mohammadomar A Feb. 23, 2021, 9:26 p.m. OK Java 8 TESTS 46 124 0
108309151 AlexTemp A Feb. 23, 2021, 2:15 p.m. OK Mono C# TESTS 45 62 2764800
108306403 NOReply223 A Feb. 23, 2021, 1:52 p.m. OK MS C++ TESTS 45 30 0
108309218 wangyeqi A Feb. 23, 2021, 2:16 p.m. OK MS C++ TESTS 45 30 0
108300566 zhuyifan A Feb. 23, 2021, 1:08 p.m. OK MS C++ TESTS 45 31 0
108300969 AlexMax37 A Feb. 23, 2021, 1:11 p.m. OK MS C++ TESTS 45 31 0
108306504 Inoplanetanen A Feb. 23, 2021, 1:53 p.m. OK MS C++ TESTS 45 46 0
108343279 AliiHME A Feb. 23, 2021, 9:47 p.m. OK MS C++ 2017 TESTS 46 31 0
108362023 armand A Feb. 24, 2021, 5:53 a.m. OK MS C++ 2017 TESTS 48 31 0
108347187 hgb202003013010 A Feb. 24, 2021, 1:06 a.m. OK MS C++ 2017 TESTS 46 31 0
108341704 moreda A Feb. 23, 2021, 8:54 p.m. OK MS C++ 2017 TESTS 46 31 0
108331107 lhcalphaA A Feb. 23, 2021, 5:37 p.m. OK MS C++ 2017 TESTS 45 31 0
108329126 laym0n A Feb. 23, 2021, 5:12 p.m. OK MS C++ 2017 TESTS 45 31 0
108317234 mary.avetisyan A Feb. 23, 2021, 3:30 p.m. OK MS C++ 2017 TESTS 45 31 0
108306821 truevampire A Feb. 23, 2021, 1:55 p.m. OK MS C++ 2017 TESTS 45 31 0
108305841 whiteReboot A Feb. 23, 2021, 1:47 p.m. OK MS C++ 2017 TESTS 45 31 0
108304727 picofarad A Feb. 23, 2021, 1:38 p.m. OK MS C++ 2017 TESTS 45 31 0
108315539 axoctavian A Feb. 23, 2021, 3:14 p.m. OK .NET Core C# TESTS 45 93 716800
108315695 ILoveEveryone A Feb. 23, 2021, 3:15 p.m. OK .NET Core C# TESTS 45 93 1331200
108343398 maciaas A Feb. 23, 2021, 9:53 p.m. OK PyPy 2 TESTS 46 108 3276800
108307789 jaglike_makkar A Feb. 23, 2021, 2:04 p.m. OK PyPy 3 TESTS 45 93 2150400
108329707 aayush_1607 A Feb. 23, 2021, 5:19 p.m. OK PyPy 3 TESTS 45 108 1740800
108313344 skhan_org A Feb. 23, 2021, 2:53 p.m. OK PyPy 3 TESTS 45 108 1843200
108307114 raxtar A Feb. 23, 2021, 1:58 p.m. OK PyPy 3 TESTS 45 108 1843200
108323153 yinuowang A Feb. 23, 2021, 4:33 p.m. OK PyPy 3 TESTS 45 109 1433600
108309329 Sahitya02 A Feb. 23, 2021, 2:17 p.m. OK PyPy 3 TESTS 45 109 1433600
108321748 Leggasick A Feb. 23, 2021, 4:18 p.m. OK PyPy 3 TESTS 45 109 1536000
108314192 hritik3878 A Feb. 23, 2021, 3:01 p.m. OK PyPy 3 TESTS 45 109 1536000
108334439 bhavyrajdev0 A Feb. 23, 2021, 6:24 p.m. OK PyPy 3 TESTS 46 109 1843200
108302193 jeongdongha A Feb. 23, 2021, 1:19 p.m. OK PyPy 3 TESTS 45 109 1843200
108342662 sukriti A Feb. 23, 2021, 9:24 p.m. OK Python 2 TESTS 46 77 0
108339935 god_gyeol A Feb. 23, 2021, 8:06 p.m. OK Python 3 TESTS 46 61 0
108335093 jintukumardas A Feb. 23, 2021, 6:34 p.m. OK Python 3 TESTS 46 62 0
108357984 vtiptop A Feb. 24, 2021, 5:09 a.m. OK Python 3 TESTS 48 62 0
108357846 manishaerrabelli A Feb. 24, 2021, 5:08 a.m. OK Python 3 TESTS 48 62 0
108330271 cashinhand A Feb. 23, 2021, 5:26 p.m. OK Python 3 TESTS 45 62 0
108331690 _aditya_ A Feb. 23, 2021, 5:46 p.m. OK Python 3 TESTS 45 62 0
108332406 APSManideep A Feb. 23, 2021, 5:55 p.m. OK Python 3 TESTS 46 62 0
108340265 shekharkarna3 A Feb. 23, 2021, 8:14 p.m. OK Python 3 TESTS 46 62 0
108340212 arin48 A Feb. 23, 2021, 8:12 p.m. OK Python 3 TESTS 46 62 0
108339124 fuadul A Feb. 23, 2021, 7:48 p.m. OK Python 3 TESTS 46 62 0
108336769 ocamler A Feb. 23, 2021, 7:02 p.m. OK Rust TESTS 46 31 0

remove filters

Back to search problems