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 |
---|---|---|---|---|---|---|
1687 | Codeforces Round 796 (Div. 1) | FINISHED | False | 7200 | 82913063 | June 3, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 235 ) | E | Become Big For Me | PROGRAMMING | combinatorics constructive algorithms math number theory |
B"Shinmyoumaru has a mallet that can turn objects bigger or smaller. She is testing it out on a sequence a and a number v whose initial value is 1 . She wants to make v = gcd limits_{i ne j} {a_i cdot a_j } by no more than 10^5 operations ( gcd limits_{i ne j} {a_i cdot a_j } denotes the gcd of all products of two distinct elements of the sequence a ). In each operation, she picks a subsequence b of a , and does one of the followings: Note that she does not need to guarantee that v is an integer, that is, v does not need to be a multiple of mathrm{lcm}(b) when performing Reduce. Moreover, she wants to guarantee that the total length of b chosen over the operations does not exceed 10^6 . Fine a possible operation sequence for her. You don't need to minimize anything. The first line contains a single integer n ( 2 <= q n <= q 10^5 ) -- the size of sequence a . The second line contains n integers a_1,a_2, cdots,a_n ( 1 <= q a_i <= q 10^6 ) -- the sequence a . It can be shown that the answer exists. The first line contains a non-negative integer k ( 0 <= q k <= q 10^5 ) -- the number of operations. The following k lines contains several integers. For each line, the first two integers f ( f in {0,1 } ) and p ( 1 <= p <= n ) stand for the option you choose ( 0 for Enlarge and 1 for Reduce) and the length of b . The other p integers of the line i_1,i_2, ldots,i_p ( 1 <= i_1<i_2< ldots<i_p <= n ) represents the indexes of the subsequence. Formally, b_j=a_{i_j} . Test case 1: gcd limits_{i ne j} {a_i cdot a_j }= gcd {60,90,150 }=30 . Perform v = v cdot operatorname{lcm} {a_1,a_2,a_3 }=30 . Test case 2: gcd limits_{i ne j} {a_i cdot a_j }=8 . Perform v = v cdot operatorname{lcm} {a_4 }=16 . Perform v = frac{v}{ operatorname{lcm} {a_1 }}=8 . "... |
Editorial of Codeforces Round 796 |
No solutions yet.