#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. HTML5调用本地摄像头画面,拍照,上传服务器

    实现功能和适用业务 采集本地摄像头获取摄像头画面,拍照保存,上传服务器: 前端上传图片处理,展示,缩小,裁剪,上传服务器 实现步骤 调取本地摄像头(getUserMedia)/上传图片,将图片/视频显 ...

  2. Oracle数据库本地和远程导入、导出

    exp本地导出与imp本地导入 exp命令: 1 exp username/psw@TEST file=d:test.dmp full=y 2 exp username/psw@TEST file=d ...

  3. 【零基础】简单说说一键果体APP的AI

    参考: https://www.jianshu.com/p/8c7a7cb7198c https://blog.csdn.net/gdymind/article/details/82696481 零. ...

  4. Final——PowerShell Empire

    一.介绍 Empire是一款针对Windows平台的.使用PowerShell脚本作为攻击载荷的渗透攻击框架工具,具有从stager生成.提权到渗透维持的一系列功能.Empire实现了无需powers ...

  5. docker安装并设置开机启动(CentOS7/8)

    CentOS7.2 docker分为CE和EE版本,EE版本收费,一般我们使用CE版本就满足要求了 docker安装及启动 docker安装很简单,直接使用如下命令安装即可,安装后的docker版本即 ...

  6. 一个简易的PHP读取CSV文件的方法

    1. 思路:先打开文件,读取出文件有多少行,然后逐行读取数据放入一个数组中 public function read_csv_lines($csv_file = '', $lines = 0, $of ...

  7. Go语言fmt.Printf使用指南(占位符总结)

    本文整理了Go语言的标准输出流(fmt.Printf)在打印到屏幕时的格式化输出操作. 在这里按照占位符将被替换的变量类型划分,更方便查询和记忆. 总结 1.1 General(通用占位符) 占位符 ...

  8. sqlserver创建链接服务器连接sqlserver脚本

    示例: EXEC sp_addlinkedserver @server='MyLinkServer', --链接服务器别名 @srvproduct='', @provider='SQLOLEDB', ...

  9. DeepLearningBook(中文版)书PDF

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

  10. 快速解决设置Android 23.0以上版本对SD卡的读写权限无效的问题

    快速解决设置Android 23.0以上版本对SD卡的读写权限无效的问题 转 https://www.jb51.net/article/144939.htm 今天小编就为大家分享一篇快速解决设置And ...