首页 > 代码库 > Codeforces Round #245 (Div. 2) A - Points and Segments (easy)
Codeforces Round #245 (Div. 2) A - Points and Segments (easy)
水到家了
#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; }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。