#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <math.h>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <string.h>
#include <bitset>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, P2 = 998244353, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head #ifdef ONLINE_JUDGE
const int N = 1e6+10;
#else
const int N = 111;
#endif int n, cnt, a[N];
set<int> s;
vector<int> v, f;
void pr() {
v.clear();
for (int x:s) v.pb(x);
int sz = v.size();
REP(i,0,sz-2) {
printf("1 %d %d\n",v[i],v[i+1]),++cnt;
}
}
int main() {
scanf("%d", &n);
REP(i,1,n) {
scanf("%d",a+i);
if (!a[i]) v.pb(i);
if (a[i]<0) f.pb(i);
s.insert(i);
}
int sz = v.size();
if (sz==n) return pr(),0;
REP(i,0,sz-2) {
printf("1 %d %d\n",v[i],v[i+1]),++cnt,s.erase(v[i]);
}
if (f.size()%2) {
int mx = -2e9, pos;
for (int x:f) if (a[x]>mx) mx=a[x],pos=x;
if (v.size()) printf("1 %d %d\n",pos,v.back()),++cnt,s.erase(pos);
else printf("2 %d\n",pos),++cnt,s.erase(pos);
}
if (cnt==n-1) return 0;
if (v.size()) {
printf("2 %d\n",v.back()),++cnt,s.erase(v.back());
}
pr();
}

Array Product CodeForces - 1042C (细节)的更多相关文章

  1. codeforces 1042c// Array Product// Codeforces Round #510(Div. 2)

    题意:给出一个数组,2种操作:.1:x*y然后x消失,2:除掉x(2操作最多只能进行一次).问最大的结果的一种操作方式.逻辑题,看能不能想全面. 1先数好0,正,负的数量,zero,pos,neg.如 ...

  2. Array Product(模拟)

    Array Product http://codeforces.com/problemset/problem/1042/C You are given an array aa consisting o ...

  3. codeforces 1042C Array Product【构造】

    题目:戳这里 题意:n个数,两种操作,第一种是a[i]*a[j],删掉a[i],第一种是直接删除a[i](只能用一次)剩下的数序列号不变.操作n-1次,使最后剩下的那个数最大化. 解题思路: 正数之间 ...

  4. Codeforces Round #510 #C Array Product

    http://codeforces.com/contest/1042/problem/C 给你一个有n个元素序列,有两个操作:1,选取a[i]和a[j],删除a[i],将$a[i]*a[j]$赋值给a ...

  5. Codeforces Round #510 (Div. 2) C. Array Product

    题目 题意: 给你n个数,有两种操作,操作1是把第i个位置的数删去, 操作2 是把 a[ j ]= a[ i ]* a[ j ],把a[ i ]删去 .n-1个操作以后,只剩1个数,要使这个数最大 . ...

  6. Makes And The Product CodeForces - 817B (思维+构造)

    B. Makes And The Product time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  7. Array Division CodeForces - 808D (构造+实现)

    Vasya has an array a consisting of positive integer numbers. Vasya wants to divide this array into t ...

  8. CF1042C Array Product(贪心,模拟)

    题目描述 You are given an array aa consisting of nn integers. You can perform the following operations w ...

  9. Array GCD CodeForces - 624D (dp,gcd)

    大意: 给定序列, 给定常数a,b, 两种操作, (1)任选一个长为$t$的子区间删除(不能全部删除), 花费t*a. (2)任选$t$个元素+1/-1, 花费t*b. 求使整个序列gcd>1的 ...

随机推荐

  1. 使用io/ioutil进行读写文件

    读文件: package main import ( "fmt" "io/ioutil" ) func main() { b, err := ioutil.Re ...

  2. 包与类的命名 - service tool util 区别

    包与类的命名和定位时,service tool util 常常搞混淆,在此分析一下它们的定位: 名称 特点与定位 独立性 方法和类的属性 util 通用的.与业务无关的,可以独立出来,可供其他项目使用 ...

  3. shell 从键盘读取输入时删除输入的字符

    [参考文章]:stty命令的用法全解 [参考文章]:shell——read时退格异常(shell修改删除符) stty srase ^h read  -p  "请输入参数信息" 在 ...

  4. 解惑spring事务传播特性之嵌套事务

    /** * Support a current transaction, create a new one if none exists. * Analogous to EJB transaction ...

  5. session cookie傻傻分不清

    做了这么多年测试,还是分不清什么是cookie,什么是session?很正常,很多初级开发工程师可能到现在都搞不清什么是session,cookie相对来说会简单很多. 下面这篇文章希望能够帮助大家分 ...

  6. LeetCode 无重复字符的最长子串(探索字节跳动)

    题目描述 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度. 示例 1: 输入: "abcabcbb" 输出: 3 解释: 因为无重复字符的最长子串是 "a ...

  7. 在HearthRanger中使用Silverfish

    I'm new here and have never used this bot before. But a few days ago I tried it and I liked it :) I ...

  8. CNN中感受野大小的计算

    1 感受野的概念 从直观上讲,感受野就是视觉感受区域的大小.在卷积神经网络中,感受野的定义是 卷积神经网络每一层输出的特征图(feature map)上的像素点在原始图像上映射的区域大小. 2 感受野 ...

  9. Kbengine游戏引擎-【4】demo-kbengine_unity3d_demo 在容器docker上安装测试

    git地址:https://github.com/kbengine/kbengine_unity3d_demo Demo中文地址:https://github.com/kbengine/kbengin ...

  10. DeepLearningBook(中文版)书PDF

    介绍深度学历基础理论.模型和应用.(738页). 第一部分 应用数学与机器学习基础,包括深度学习需要用到的线性代数.概率与信息论.数值计算.机器学习等内容. 第二部分 深度网络:现代实践,包括深度前馈 ...