codeforces 430A Points and Segments (easy)(理解能力有待提高……)
2014-09-02 21:17
453 查看
题目
View Code
//终于看懂题目了,,,, //一条线段里面不是每个坐标上都有要染色的点,所以为了满足条件,只能考虑那些给出坐标的点 //所以就要排序一下了,不能直接根据坐标0 1 0 1…… #include <cstdio> #include <cstring> #include <algorithm> using namespace std ; struct tt { int a,b; }aa[110]; int cmp(tt x,tt y) { return x.a<y.a; } int cmp1(tt x,tt y) { return x.b<y.b; } int main () { int n,m; scanf("%d%d",&n,&m); for(int i=0;i<n;i++) { scanf("%d",&aa[i].a); aa[i].b=i; } sort(aa,aa+n,cmp); for(int i=0;i<n;i++) aa[i].a=i%2; int yi=0; sort(aa,aa+n,cmp1); for(int i=0;i<n;i++) { if(yi)printf(" ");yi=1; printf("%d",aa[i].a); } return 0 ; }
View Code
相关文章推荐
- Codeforces 430A Points and Segments (easy)
- Codeforces 430A Points and Segments (easy)
- Codeforces 430 A. Points and Segments (easy)
- codeforces 430 A Points and Segments (easy)
- Codeforces Round #245 (Div. 2) A - Points and Segments (easy)
- Codeforces Round #245 (Div. 2) A - Points and Segments (easy)
- [欧拉回路] Codeforces 429E #245 (Div. 1) E. Points and Segments
- Codeforces Round #245 (Div. 2) A. Points and Segments (easy) 贪心
- 怎样提高阅读理解能力
- 【26.67%】【codeforces 596C】Wilbur and Points
- 我国软件企业工程能力有待提高,需要竞争力转型
- Codeforces 596C Wilbur and Points 【贪心 + sort】
- CodeForces 610 D.Vika and Segments(线段树+扫描线)
- Codeforces 295 B Greg and Graph (Floyd_Warshall的深入理解)
- Codeforces 610D Vika and Segments 线段树+离散化+扫描线
- Codeforces-289a I Polo the Penguin and Segments
- codeforces 610D D. Vika and Segments(离散化+线段树+扫描线算法)
- 如何提高理解能力
- Codeforces 610D Vika and Segments 【线段树扫描线 求面积并】
- 如何提高理解能力