CodeForces 23C Oranges and Apples 抽屉原理
来源:互联网 发布:电脑wifi无法连接网络 编辑:程序博客网 时间:2024/06/05 21:08
题目链接:点击打开链接
#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 200005ll 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;}/*340 -8352 -80-21 -4*/
0 0
- CodeForces 23C Oranges and Apples 抽屉原理
- CodeForces 23C Oranges and Apples
- CodeForces 23C-Oranges and Apples
- CodeForces 23C Oranges and Apples (简单题)
- C. Oranges and Apples
- Codeforence 23C Oranges and Apples
- Codeforces 585C Alice, Bob, Oranges and Apples
- Codeforces 585C Alice, Bob, Oranges and Apples(规律)
- [Codeforces 585C] Alice, Bob, Oranges and Apples (Stern-Brocot Tree + 更相减损法)
- CodeForces 586E Alice, Bob, Oranges and Apples 水题
- Codeforces Round #325 (Div. 2) E. Alice, Bob, Oranges and Apples
- Code Forces 585 C. Alice, Bob, Oranges and Apples(数论)
- Codeforces 449C Jzzhu and Apples(构造)
- cf23C Oranges and Apples (贪心_好题)
- Codeforces 449C - Jzzhu and Apples / 450E - Jzzhu and Apples
- codeforces 449C C. Jzzhu and Apples(数论+构造)
- CodeForces 449C Jzzhu and Apples 数学+素数
- CodeForces 449 C.Jzzhu and Apples(构造+数论)
- java.lang.OutOfMemoryError: Java heap space错误及处理办法
- iReport不显示中文
- hdu 2993 MAX Average Problem (斜率优化dp入门)
- Java AWT常用组件
- SharePoint 如何制作自动跳转页面
- CodeForces 23C Oranges and Apples 抽屉原理
- 研磨Hadoop源码(四)Hadoop Rack Awareness(机架感知)
- Orange the Apple (SDUT 2061)
- Android 多分辨率机器适配
- opnet学习总结
- MAC下配置maven
- java内存分配分析/栈内存、堆内存
- 大规模SwSw然后把电铝
- cocos2dx中使用的tolua关于字符串处理的一个问题