#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. 在CSS中水平居中和垂直居中:完整的指南

    这篇文章将会按照如下思路展开: 一.水平居中 1. 行内元素水平居中 2. block元素水平居中 3. 多个块级元素水平居中 二.垂直居中 1. 行内元素水平居中 2. block元素水平居中 3. ...

  2. Nginx之configure选项

    1. 通用配置项 --prefix=<path>:Nginx 安装的根路径,所有其他的路径都要依赖于该选项. --sbin-path=<path>:指定 Nginx 二进制文件 ...

  3. psql物化视图自动更新

    更新物化视图示例 CREATE TABLE model.test ( id SERIAL PRIMARY KEY, name VARCHAR(60)); . 创建物化视图 CREATE MATERIA ...

  4. Activity切换动画

    下一页动画 trans_in.xml <?xml version="1.0" encoding="utf-8"?> <translate an ...

  5. 02 MySQL之数据表的基本操作

    01-创建数据表 # 切换数据库 use test_db; # 创建数据表 语法规则如下: create table 表名 ( 字段名1, 数据类型 [列级别约束条件] [默认值], 字段名2, 数据 ...

  6. 小D课堂 - 新版本微服务springcloud+Docker教程_5-01分布式核心知识之熔断、降级

    笔记: 第五章 互联网架构服务降级熔断 Hystrix 实战 1.分布式核心知识之熔断.降级讲解     简介:系统负载过高,突发流量或者网络等各种异常情况介绍,常用的解决方案 1.熔断:       ...

  7. [Spark] Spark 3.0 Accelerator Aware Scheduling - GPU

    Ref: Spark3.0 preview预览版尝试GPU调用(本地模式不支持GPU) 预览版本:https://archive.apache.org/dist/spark/spark-3.0.0-p ...

  8. VMware虚拟机桥接方式与真实主机共享上网

    原始出处 .http://meiling.blog.51cto.com/6220221/1367695 一.先介绍一下VMware网络设置的三种方式: VMWare提供了三种工作模式,host-onl ...

  9. EasyTouch5插件使用 EasyTouch手势检测功能

    (1)导入EasyTouch5插件,注意该插件对Unity有版本要求 (2)首先在场景中创建一个EasyTouch,这个是必需的,它是进行检测的核心组件,场景中有任何物体使用了EasyTouch的东西 ...

  10. 通过火狐谋智查询API

    谋智中文版网址 https://developer.mozilla.org 示例 site: developer.mozilla.org window 通过百度高级用法查API site: 网址 搜索 ...