这题目有点变态 个人感觉, 难道cin和cout的花费时间真的要比scanf和printf多很多么
我吧cin和cout改成scanf和printf就AC了
不然一直TL
看来以后这点我要注意下 H呵呵
AC代码:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct node{
int weight;
int num;
}inf[10009];
bool cmp(const node &a,const node &b){
if(a.weight!=b.weight)
return a.weight>b.weight? 0:1;
else
return a.num>b.num?0:1;
}
int main(){
int n;
int flag=0;
while( scanf("%d",&n)!=EOF ){
if(flag) printf("\n");
for(int i=0; i<n; ++i){
scanf("%d", &inf[i].weight);
inf[i].num=i+1;
}
sort(inf,inf+n,cmp);
for(int i=0; i<n; i+=2 )
printf("%d %d\n", inf[i].num,inf[i+1].num);
flag=1;
}
}