CodeForces 740C Alyona and mex
构造。
比较骚的构造题。肯定可以构造出$min(R-L+1)$,只要$0$ $1$ $2$ $...$ $R-L$ $0$ $1$ $2$ $...$ $R-L$填数字即可,这样任意一段区间都包含了$0$ $1$ $2$ $...$ $R-L$。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<ctime>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0);
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar();
x = ;
while(!isdigit(c)) c = getchar();
while(isdigit(c))
{
x = x * + c - '';
c = getchar();
}
} int n,m; int main()
{
cin>>n>>m; int len=;
for(int i=;i<=m;i++)
{
int L,R; cin>>L>>R;
len=min(len,R-L+);
} cout<<len<<endl;
for(int i=;i<n;i++)
{
cout<<(i+len-)%len<<" ";
}
cout<<endl;
return ;
}
CodeForces 740C Alyona and mex的更多相关文章
- Codeforces 740C. Alyona and mex 思路模拟
C. Alyona and mex time limit per test: 2 seconds memory limit per test: 256 megabytes input: standar ...
- CodeForces 682B Alyona and Mex (排序+离散化)
Alyona and Mex 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/B Description Someone gave ...
- CodeForces 682B Alyona and Mex (题意水题)
题意:给定一个序列,你可以对这里面的数用小于它的数来代替,最后让你求,改完后的最大的序列中缺少的最小的数. 析:这个题,读了两个多小时也没读懂,要是读懂了,肯定能做出来...没什么可说的,就是尽量凑1 ...
- Codeforces Round #381 (Div. 1) A. Alyona and mex 构造
A. Alyona and mex 题目连接: http://codeforces.com/contest/739/problem/A Description Alyona's mother want ...
- Codeforces Round #358 (Div. 2) B. Alyona and Mex 水题
B. Alyona and Mex 题目连接: http://www.codeforces.com/contest/682/problem/B Description Someone gave Aly ...
- Codeforces Round #381 (Div. 2)C. Alyona and mex(思维)
C. Alyona and mex Problem Description: Alyona's mother wants to present an array of n non-negative i ...
- Codeforces Round #358 (Div. 2)B. Alyona and Mex
B. Alyona and Mex time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- Alyona and mex
Alyona and mex time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...
- Codeforces E. Alyona and a tree(二分树上差分)
题目描述: Alyona and a tree time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
随机推荐
- UVA 10214 Trees in a Wood
https://vjudge.net/problem/UVA-10214 题意:你站在原点,每个坐标位置有一棵高度相同的树,问能看到多少棵树 ans=Σ gcd(x,y)=1 欧拉函数搞搞 #incl ...
- [洛谷P2051] [AHOI2009]中国象棋
洛谷题目链接:[AHOI2009]中国象棋 题目描述 这次小可可想解决的难题和中国象棋有关,在一个N行M列的棋盘上,让你放若干个炮(可以是0个),使得没有一个炮可以攻击到另一个炮,请问有多少种放置方法 ...
- Android开发——为移动的Paint元素指定图片的方法
源 起 最近在写一个类似“围住神经猫”的应用,现在需要给一个可以移动的Paint元素指定一张图片,如下图,要把黄点改成其他图片: Paint所在的类继承于SurfaceView,SurfaceVie ...
- 【LuoguP3038/[USACO11DEC]牧草种植Grass Planting】树链剖分+树状数组【树状数组的区间修改与区间查询】
模拟题,可以用树链剖分+线段树维护. 但是学了一个厉害的..树状数组的区间修改与区间查询.. 分割线里面的是转载的: ----------------------------------------- ...
- 【Foreign】咏叹 [模拟退火]
咏叹 Time Limit: 100 Sec Memory Limit: 256 MB Description 有n根木棍,第i根长度为ai.你要贴着墙围出一个矩形区域,木棍围成的矩形边缘必须平行或 ...
- MSSQL 视图/事务(TRAN[SACTION])/存储过程(PROC[EDURE])/触发器(TRIGGER )
--视图 视图是一张虚拟表,它表示一张表的部分数据或多张表的综合数据,其结构和数据是建立在对表的查询基础上 视图在操作上和数据表没有什么区别,但两者的差异是其本质是不同: 数据表是实际存储记录的地方, ...
- hdu 1070 Milk(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070 Milk Time Limit: 2000/1000 MS (Java/Others) M ...
- MSF爆破MSSQL
show options: msf auxiliary(scanner/mssql/mssql_login) > show options Module options (auxiliary/s ...
- centos7系统安装配置
下载centos7 iso镜像 电脑里面本来有ubuntu系统,直接在u盘做好启动盘安装即可,选择手动分区(忘了),将原本ubuntu系统分区压缩200G.系统不要选择最小化,选择gnome的图形界面 ...
- inetdev_init && inetdev_destroy
inetdev_init为传入设备分配和绑定ip控制块,查看其调用关系如下: fs_initcall(inet_init)---->inet_init---->ip_init----> ...