CF1687E.Become Big For Me
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Come, let's build a world where even the weak are not forgotten!
—Kijin Seija, Double Dealing Characters
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=i=jgcd{ai⋅aj} by no more than 105 opreations ( i=jgcd{ai⋅aj} 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:
- Enlarge: v=v⋅lcm(b)
- Reduce: v=lcm(b)v
Note that she does not need to guarantee that v is an integer, that is, v does not need to be a multiple of lcm(b) when performing Reduce.
Moreover, she wants to guarantee that the total length of b chosen over the operations does not exceed 106 . Fine a possible operation sequence for her. You don't need to minimize anything.
输入格式
The first line contains a single integer n ( 2≤n≤105 ) — the size of sequence a .
The second line contains n integers a1,a2,⋯,an ( 1≤ai≤106 ) — the sequence a .
It can be shown that the answer exists.
输出格式
The first line contains a non-negative integer k ( 0≤k≤105 ) — the number of operations.
The following k lines contains several integers. For each line, the first two integers f ( f∈{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 i1,i2,…,ip ( 1≤i1<i2<…<ip≤n ) represents the indexes of the subsequence. Formally, bj=aij .
输入输出样例
输入#1
3 6 10 15
输出#1
1 0 3 1 2 3
输入#2
4 2 4 8 16
输出#2
2 0 1 4 1 1 1
说明/提示
Test case 1:
i=jgcd{ai⋅aj}=gcd{60,90,150}=30 .
Perform v=v⋅lcm{a1,a2,a3}=30 .
Test case 2:
i=jgcd{ai⋅aj}=8 .
Perform v=v⋅lcm{a4}=16 .
Perform v=lcm{a1}v=8 .