标签: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