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, ...
随机推荐
- php 注册审核
注册界面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3 ...
- JQ JSON数据类型
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- DOM - EventListener 句柄操作
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" c ...
- Linux下pipe使用注意事项
转自:http://blog.yufeng.info/archives/1485 Linux下的pipe使用非常广泛, shell本身就大量用pipe来粘合生产者和消费者的. 我们的服务器程序通常会用 ...
- 如何减少JS的全局变量污染
A,唯一变量 B,闭包
- POJ3415 Common Substrings(后缀数组 单调栈)
借用罗穗骞论文中的讲解: 计算A 的所有后缀和B 的所有后缀之间的最长公共前缀的长度,把最长公共前缀长度不小于k 的部分全部加起来.先将两个字符串连起来,中间用一个没有出现过的字符隔开.按height ...
- 解决oracle11g 空表不能exp导出的问题
在使用exp备份数据库,然后使用imp导入的时候出现了好多表或者视图不存在的错误信息. 究其原因,是11G中增加了一个新的特性:数据条数是0时不分配segment,所以就不能被导出. 解决思路:就是向 ...
- UDP通讯程序设计
UDP通讯程序设计 一.函数化 1.1服务器使用的函数 创建socket----->socket 绑定地址-------->bind 接受数据-------->recvfrom 发送 ...
- C++ 中 char 与 int 转换问题
itoa 功 能:把一整数转换为字符串 函 数:char *itoa(int value, char *string, int radix); 解 释:itoa 是英文integer to ar ...
- 运行在linux上的mysql常用命令
mysql的注释:--或者# 1.mysql服务进程的命令 service mysqld start;#启动mysql服务 service mysqld status;#查看服务状态 service ...