Codeforces Round 846 (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
1780 Codeforces Round 846 (Div. 2) FINISHED False 7200 62609063 Jan. 25, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1586 ) F Three Chairs PROGRAMMING bitmasks brute force combinatorics data structures number theory sortings

B"One day Kira found n friends from Morioh and decided to gather them around a table to have a peaceful conversation. The height of friend i is equal to a_i . It so happened that the height of each of the friends is unique. Unfortunately, there were only 3 chairs in Kira's house, and obviously, it will not be possible to seat all friends! So, Kira has to invite only 3 of his friends. But everything is not so simple! If the heights of the lowest and the tallest of the invited friends are not coprime, then the friends will play tricks on each other, which will greatly anger Kira. Kira became interested, how many ways are there to choose 3 of his friends so that they don't play tricks? Two ways are considered different if there is a friend invited in one way, but not in the other. Formally, if Kira invites friends i , j , and k , then the following should be true: gcd( min(a_i, a_j, a_k), max(a_i, a_j, a_k)) = 1 , where gcd(x, y) denotes the greatest common divisor (GCD) of the numbers x and y . Kira is not very strong in computer science, so he asks you to count the number of ways to invide friends. The first line contains the number n ( 3 <= n <= 3 cdot10^5 ) -- the number of Kira's friends. The next line contains n distinct integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 3 cdot10^5 ) -- heights of Kira's friends. In a single line output the number of ways to invite three friends. In the first example, only one way is suitable: invite friends 1 , 2 , and 3 . Here 1 < 2 < 3 , and the numbers 1 and 3 are coprime. "...

Tutorials

111841

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
190562840 mban259 F Jan. 25, 2023, 4:24 p.m. OK C# 10 TESTS 36 249 42291200
190569003 rainboy F Jan. 25, 2023, 5:09 p.m. OK GNU C11 TESTS 36 124 2662400
190613903 icyM3tra F Jan. 26, 2023, 5:26 a.m. OK GNU C++14 TESTS 36 78 5222400
190554757 awoo F Jan. 25, 2023, 4 p.m. OK GNU C++14 TESTS 36 124 6041600
190611179 Leasier F Jan. 26, 2023, 4:42 a.m. OK GNU C++14 TESTS 36 124 7782400
190606313 QAQ_Becase F Jan. 26, 2023, 2:59 a.m. OK GNU C++14 TESTS 36 124 44134400
190553509 beginend F Jan. 25, 2023, 3:57 p.m. OK GNU C++14 TESTS 36 139 5120000
190572836 samnever F Jan. 25, 2023, 5:31 p.m. OK GNU C++14 TESTS 36 140 5120000
190614009 icyM3tra F Jan. 26, 2023, 5:28 a.m. OK GNU C++14 TESTS 36 140 5222400
190601255 Carey_Knight F Jan. 26, 2023, 12:27 a.m. OK GNU C++14 TESTS 36 140 7270400
190611160 Leasier F Jan. 26, 2023, 4:42 a.m. OK GNU C++14 TESTS 36 140 7782400
190603294 lbntxdy F Jan. 26, 2023, 1:38 a.m. OK GNU C++14 TESTS 36 156 14438400
190613621 Sempr F Jan. 26, 2023, 5:22 a.m. OK GNU C++17 TESTS 36 109 4915200
190600807 I_love_Anya_Gorodilova F Jan. 26, 2023, 12:11 a.m. OK GNU C++17 TESTS 36 124 3584000
190552835 El3ageed_Abu_Shehab F Jan. 25, 2023, 3:55 p.m. OK GNU C++17 TESTS 36 124 3891200
190554438 Marckess F Jan. 25, 2023, 4 p.m. OK GNU C++17 TESTS 36 124 7270400
190553612 zlc1114 F Jan. 25, 2023, 3:57 p.m. OK GNU C++17 TESTS 36 124 16076800
190558694 goodbee F Jan. 25, 2023, 4:12 p.m. OK GNU C++17 TESTS 36 155 7270400
190569298 ikaurov F Jan. 25, 2023, 5:10 p.m. OK GNU C++17 TESTS 36 156 3584000
190556646 Ssarpa F Jan. 25, 2023, 4:06 p.m. OK GNU C++17 TESTS 36 156 12595200
190549976 Ronnie007 F Jan. 25, 2023, 3:48 p.m. OK GNU C++17 TESTS 36 171 6041600
190590720 machhra F Jan. 25, 2023, 8:17 p.m. OK GNU C++17 TESTS 36 171 6451200
190607077 ChroneZU F Jan. 26, 2023, 3:17 a.m. OK GNU C++17 (64) TESTS 36 62 5120000
190607114 _chroneZ F Jan. 26, 2023, 3:18 a.m. OK GNU C++17 (64) TESTS 36 78 5120000
190556756 rniya F Jan. 25, 2023, 4:06 p.m. OK GNU C++17 (64) TESTS 36 78 7270400
190607878 Prakhar1998 F Jan. 26, 2023, 3:37 a.m. OK GNU C++17 (64) TESTS 36 78 9625600
190613323 Semp F Jan. 26, 2023, 5:17 a.m. OK GNU C++17 (64) TESTS 36 93 4915200
190555275 ikefumy F Jan. 25, 2023, 4:02 p.m. OK GNU C++17 (64) TESTS 36 93 5939200
190613010 Semp F Jan. 26, 2023, 5:12 a.m. OK GNU C++17 (64) TESTS 36 93 6144000
190548087 iLLusio F Jan. 25, 2023, 3:44 p.m. OK GNU C++17 (64) TESTS 36 93 7270400
190564318 waifus F Jan. 25, 2023, 4:30 p.m. OK GNU C++17 (64) TESTS 36 93 8396800
190613206 Semp F Jan. 26, 2023, 5:15 a.m. OK GNU C++17 (64) TESTS 36 109 4915200
190586384 magnus.hegdahl F Jan. 25, 2023, 7:21 p.m. OK GNU C++20 (64) TESTS 36 31 5222400
190553476 raztun F Jan. 25, 2023, 3:57 p.m. OK GNU C++20 (64) TESTS 36 62 3584000
190553102 BurnedChicken F Jan. 25, 2023, 3:56 p.m. OK GNU C++20 (64) TESTS 36 62 3584000
190604155 JorgeIbanez F Jan. 26, 2023, 2:04 a.m. OK GNU C++20 (64) TESTS 36 62 3584000
190579091 aryanc403 F Jan. 25, 2023, 6:13 p.m. OK GNU C++20 (64) TESTS 36 62 4812800
190561738 magnus.hegdahl F Jan. 25, 2023, 4:21 p.m. OK GNU C++20 (64) TESTS 36 62 4915200
190606536 EasonCookie197 F Jan. 26, 2023, 3:04 a.m. OK GNU C++20 (64) TESTS 36 62 6041600
190556709 fastmath F Jan. 25, 2023, 4:06 p.m. OK GNU C++20 (64) TESTS 36 62 7270400
190605371 jiangbowen F Jan. 26, 2023, 2:36 a.m. OK GNU C++20 (64) TESTS 36 62 9216000
190615564 fractal F Jan. 26, 2023, 5:50 a.m. OK GNU C++20 (64) TESTS 36 62 16076800
190616100 Dinesh_Pandiyan F Jan. 26, 2023, 5:58 a.m. OK Java 11 TESTS 36 421 18841600
190569356 merlin_ F Jan. 25, 2023, 5:11 p.m. OK Java 11 TESTS 36 421 18841600
190602253 dzhi F Jan. 26, 2023, 1:03 a.m. OK Java 11 TESTS 36 467 0
190573873 profchi F Jan. 25, 2023, 5:37 p.m. OK Java 11 TESTS 36 998 37478400
190556915 DylanSmith F Jan. 25, 2023, 4:06 p.m. OK Java 8 TESTS 36 997 23449600
190610576 xxh1999 F Jan. 26, 2023, 4:32 a.m. OK PyPy 3 TESTS 36 998 31744000
190579007 1_2_3_4_5_9 F Jan. 25, 2023, 6:12 p.m. OK PyPy 3-64 TESTS 36 343 70144000
190559029 misorin F Jan. 25, 2023, 4:13 p.m. OK PyPy 3-64 TESTS 36 499 42393600
190612998 huangxw F Jan. 26, 2023, 5:12 a.m. OK PyPy 3-64 TESTS 36 592 43008000
190610390 xxh1999 F Jan. 26, 2023, 4:28 a.m. OK PyPy 3-64 TESTS 36 935 40857600
190611680 NINGucas F Jan. 26, 2023, 4:50 a.m. OK PyPy 3-64 TESTS 36 966 53760000

remove filters

Back to search problems