首页 > 其他 > 详细

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

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

水到家了

#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)

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!