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_ = , int pos_ = ){
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 = ; i < n ; ++ i){
cin >> points[i].pos;
points[i].index = i;
}
sort(points.begin(),points.end());
for(int i = ; i < m; ++ i) cin >> l >> r;
vector<int> res(n,);
for(int i = ; i < n ; ++ i ){
if(i% == ) res[points[i].index] =;
}
cout<<res[];
for(int i = ; i <n ; ++ i ) cout<<" "<<res[i];
cout<<endl; }
Codeforces Round #245 (Div. 2) A - Points and Segments (easy)的更多相关文章
- Codeforces Round #245 (Div. 2) A. Points and Segments (easy) 贪心
A. Points and Segments (easy) Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/con ...
- Codeforces Round #501 (Div. 3) 1015A Points in Segments (前缀和)
A. Points in Segments time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #486 (Div. 3) D. Points and Powers of Two
Codeforces Round #486 (Div. 3) D. Points and Powers of Two 题目连接: http://codeforces.com/group/T0ITBvo ...
- Codeforces Round #245 (Div. 2)
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/yew1eb/article/details/25609981 A Points and Segmen ...
- Codeforces Round #466 (Div. 2) -A. Points on the line
2018-02-25 http://codeforces.com/contest/940/problem/A A. Points on the line time limit per test 1 s ...
- Codeforces Round #319 (Div. 1) C. Points on Plane 分块
C. Points on Plane Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/576/pro ...
- Codeforces Round #466 (Div. 2) A. Points on the line[数轴上有n个点,问最少去掉多少个点才能使剩下的点的最大距离为不超过k。]
A. Points on the line time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #245 (Div. 1) 429D - Tricky Function 最近点对
D. Tricky Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/42 ...
- Codeforces Round #245 (Div. 1) B. Working out (简单DP)
题目链接:http://codeforces.com/problemset/problem/429/B 给你一个矩阵,一个人从(1, 1) ->(n, m),只能向下或者向右: 一个人从(n, ...
随机推荐
- 线性代数 -- Linear Algebra with Applications
@.如果线性方程组无解,则称该方程组是不相容的(inconsistent). @.如果线性方程组至少存在一个解,则称该方程组是相容的(consistent). @.等价方程组(equivalent s ...
- htop 源码安装
htop-1.0.2.tar.gz http://pan.baidu.com/s/1c1RbdIg tar -xvf htop-1.0.2.tar.gz cd htop-1.0.2 ./config ...
- Tensorflow 的Word2vec demo解析
简单demo的代码路径在tensorflow\tensorflow\g3doc\tutorials\word2vec\word2vec_basic.py Sikp gram方式的model思路 htt ...
- Android屏幕旋转总结
转自:http://www.myexception.cn/operating-system/1452058.html 1. ProjectConifg.mk中定义宏MTK_LCM_PHYSICAL_R ...
- HDU4288 Coder(线段树)
注意添加到集合中的数是升序的,先将数据读入,再离散化. sum[rt][i]表示此节点的区域位置对5取模为i的数的和,删除一个数则右边的数循环左移一位,添加一个数则右边数循环右移一位,相当于循环左移4 ...
- Linux/centos下安装riak
必备的组件: gccgcc-c++glibc-develmakepam-devel 使用yum安装相关组件 sudo yum install gcc gcc-c++ glibc-devel make ...
- [JavaCore]JAVA中的泛型
JAVA中的泛型 [更新总结] 泛型就是定义在类里面的一个类型,这个类型在编写类的时候是不确定的,而在初始化对象时,必须确定该类型:这个类型可以在一个在里定义多个:在一旦使用某种类型,在类方法中,那么 ...
- Java Socket编程(转)
Java Socket编程 对于Java Socket编程而言,有两个概念,一个是ServerSocket,一个是Socket.服务端和客户端之间通过Socket建立连接,之后它们就可以进行通信了.首 ...
- loj 1167(二分+最大流)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=26881 思路:我们可以二分最大危险度,然后建图,由于每个休息点只能 ...
- (转载)RTorrent 命令行使用说明
转自:http://blog.chinaunix.net/uid-22457844-id-2973262.html 参考:http://forum.ubuntu.org.cn/viewtopic.ph ...