zoukankan      html  css  js  c++  java
  • Codeforces Round #245 (Div. 2) A

    水到家了

    #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;
        
    }
  • 相关阅读:
    2018.11.12
    2018.11.8
    2018.11.7
    2018.11.6
    2018.11.5
    学习python课程第七天
    作业四.
    学习python课程第六天
    作业3
    学习python课程第五天
  • 原文地址:https://www.cnblogs.com/xiongqiangcs/p/3786381.html
Copyright © 2011-2022 走看看