码迷,mamicode.com
首页 > 其他好文 > 详细

Codeforces Round #245 (Div. 2) A - Points and Segments (easy)

时间:2014-06-14 21:21:40      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   color   os   

水到家了

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

struct Point{
    int index, pos;
    Point(int index_ = 0, int pos_ = 0){
        index = index_;
        pos = pos_;
    }
    
    bool operator < (const Point& a) const{
        return pos < a.pos;
    }
};

int main(){
    int n,m, l,r;
    cin >> n >> m;
    vector<Point> points(n);
    for(int i = 0 ; i < n ; ++ i){
        cin >> points[i].pos;
        points[i].index = i;
    }
    sort(points.begin(),points.end());
    for(int i = 0 ; i < m; ++ i) cin >> l >> r;
    vector<int> res(n,0);
    for(int i = 0 ; i < n ; ++ i ){
        if(i%2 == 0) res[points[i].index] =1;
    }
    cout<<res[0];
    for(int i = 1 ; i <n ; ++ i ) cout<<" "<<res[i];
    cout<<endl;
    
}

 

Codeforces Round #245 (Div. 2) A - Points and Segments (easy),布布扣,bubuko.com

Codeforces Round #245 (Div. 2) A - Points and Segments (easy)

标签:style   class   blog   code   color   os   

原文地址:http://www.cnblogs.com/xiongqiangcs/p/3786381.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!