CF1042C Array Product(模擬)
阿新 • • 發佈:2018-12-11
還沒寫完。。後面補
#include<iostream>
#include<algorithm>
#define maxn 300010
typedef struct Node{
int x;
int id;
}node;
node a[maxn];
using namespace std;
int main(){
int n,l=0,r=0,m=0;
int low[maxn],high[maxn],mid[maxn];
int Min=0x3f3f3f3f,pos=-1;
ios::sync_with_stdio(false);
cin>> n;
for(int i=1;i<=n;i++){
cin>>a[i].x;
a[i].id=i;
if(a[i].x<0) low[++l]=i;
else if(a[i].x>0) high[++r]=i;
else mid[++m]=i;
if(Min>a[i].x){
Min=a[i].x;
pos=i;
}
}
//cout<<l<<" "<<m<<" "<<r<<endl;
if(l==0 &&r==0){
for(int i=1;i<=n-1;i++) cout<<"1 "<<i<<" "<<i+1<<endl;
}
else if(l==0&&r>0){
if(m!=0){
for(int i=1;i<=m-1;i++){
cout<<"1 "<<mid[i]<<" "<<mid[i+1]<< endl;
}
cout<<"2 "<<mid[m]<<endl;
}
for(int i=1;i<=r-1;i++){
cout<<"1 "<<high[i]<<" "<<high[i+1]<<endl;
}
}
else if(l>0&&r==0){
}
return 0;
}