题目链接:点击打开链接
#include <cstdio> #include <cstring> #include <algorithm> #include <vector> #include <iostream> #include <map> #include <set> #include <math.h> using namespace std; #define inf 10000000 #define ll __int64 #define N 200005 ll n, m, v; struct node{ int a,b,pos; bool operator<(const node&x)const{ return a!=x.a?a<x.a:b<x.b; } }f[N]; int ans[N]; int main(){ ll i, j, T; cin>>T; while(T--){ cin>>n; ll all = 2*n-1; for(i=1;i<=all; i++){ cin>>f[i].a>>f[i].b; f[i].pos = i; } sort(f+1,f+all+1); ll top = 0; for(i=1;i<all; i+=2) if(f[i].b >= f[i+1].b) ans[top++]=f[i].pos; else ans[top++] = f[i+1].pos; ans[top++]=f[all].pos; puts("YES"); sort(ans,ans+top); for(i=0;i<top;i++) printf("%d%c",ans[i],i==top-1?'\n':' '); } return 0; } /* 3 40 -83 52 -80 -21 -4 */