BZOJ 2013 : [Ceoi2010]A huge tower / Luogu SP6950 CTOI10D3 - A HUGE TOWER
菜鸡.jpg
CODE
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 620005;
int n, d, a[MAXN];
int main() {
scanf("%d%d", &n, &d);
for(int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
sort(a + 1, a + n + 1);
int pt = 1, ans = 1;
for(int i = 2; i <= n; ++i) {
while(pt <= n && a[pt]+d < a[i]) ++pt;
ans = 1ll * ans * (i-pt+1) % 1000000009;
}
printf("%d\n", ans);
}
BZOJ 2013 : [Ceoi2010]A huge tower / Luogu SP6950 CTOI10D3 - A HUGE TOWER的更多相关文章
- Bzoj 2013 [Ceoi2010] A huge tower 题解
2013: [Ceoi2010]A huge tower Time Limit: 10 Sec Memory Limit: 259 MBSubmit: 471 Solved: 321[Submit ...
- bzoj 2013: A huge tower 数学
题目: 有\(N(2\leq N\leq 620000)\)块砖,要搭一个\(N\)层的塔,要求:如果砖\(A\)在砖\(B\)上面,那么\(A\)不能比\(B\)的长度\(+D\)要长.问有几种方法 ...
- BZOJ 1370: [Baltic2003]Gang团伙(luogu 1892)(种类并查集)
题面: bzoj题面有误,还是看luogu的吧 https://www.luogu.org/problemnew/show/P1892 题解: 种类并查集.. 因为有敌人的敌人是朋友这个条件,所以需要 ...
- bzoj 2013 上升计数
题意: 给一个数集和一个数d,问满足下列要求的排列数(相同的数要区分): a[i]+d>=a[i+1] ( i in [1,n) ) 因为数的给出顺序不重要,所以先排序,假如我们已经解决了前i ...
- bzoj 2013
http://www.lydsy.com/JudgeOnline/problem.php?id=2013 最初看这个题的时候,以为神题不可做,然后去找yzjc..然后做法过于简单了(' ' ...
- Kruskal || BZOJ 1601: [Usaco2008 Oct]灌水 || Luogu P1550 [USACO08OCT]打井Watering Hole
题面:P1550 [USACO08OCT]打井Watering Hole 题解:无 代码: #include<cstdio> #include<cstring> #includ ...
- 线段树合并+并查集 || BZOJ 2733: [HNOI2012]永无乡 || Luogu P3224 [HNOI2012]永无乡
题面:P3224 [HNOI2012]永无乡 题解: 随便写写 代码: #include<cstdio> #include<cstring> #include<iostr ...
- 线段树合并 || 树状数组 || 离散化 || BZOJ 4756: [Usaco2017 Jan]Promotion Counting || Luogu P3605 [USACO17JAN]Promotion Counting晋升者计数
题面:P3605 [USACO17JAN]Promotion Counting晋升者计数 题解:这是一道万能题,树状数组 || 主席树 || 线段树合并 || 莫队套分块 || 线段树 都可以写..记 ...
- LCA || BZOJ 1602: [Usaco2008 Oct]牧场行走 || Luogu P2912 [USACO08OCT]牧场散步Pasture Walking
题面:[USACO08OCT]牧场散步Pasture Walking 题解:LCA模版题 代码: #include<cstdio> #include<cstring> #inc ...
随机推荐
- poj2253(floyd变形)
题目链接:https://vjudge.net/problem/POJ-2253 题意:给出n个点的坐标,求点1到点2的forg distance,其定义为点1到点2的所有路径中最长边的最小值. 思路 ...
- TemplateView , ListView ,DetailView三种常用类视图用法
参考博客: https://blog.csdn.net/weixin_36571185/article/details/74280102
- Hadoop介绍与安装
前言 最近想学习下大数据,有点急于求成,于是去网上找了各种培训机构的视频,发现大都质量不佳,理论基本不说或者简单讲下,然后教你照猫画虎的敲代码,出了问题都没法分析.最后还是找了厦门大学的公开课从理论开 ...
- MySQL中的InnoDB中产生的死锁深究
查考地址:https://blog.csdn.net/loophome/article/details/79867174 待研究中.....
- HDU 4578 线段树玄学算法?
Transformation 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4578 Problem Description Yuanfang is p ...
- Ural 1298 Knight 题解
目录 Ural 1298 Knight 题解 题意 题解 程序 Ural 1298 Knight 题解 题意 给定一个\(n\times n(1\le n\le8)\)的国际象棋棋盘和一个骑士(基本上 ...
- hdu 1024 最大m段不相交线段和
题目传送门//res tp hdu 数据范围1e6,若是开二维会爆 考虑用滚动数组优化 #include<iostream> #include<cstdio> #include ...
- Graduation(思维,树上取叶子几次取完)
题意:https://codeforces.com/group/ikIh7rsWAl/contest/259944/problem/G 给你一颗树(可能有好几棵),你每次最多只能去掉k个叶子节点,问你 ...
- 解决python无法安装mysql数据库问题
解决python无法安装mysql数据库问题: pip install pymysql[使用这个命令来安装]
- 计算机基础与python安装
计算机基础 内容详细: 一.计算机基础 1. 计算机什么组成的 输入输出设备 cpu 硬盘 内存 中央处理器 处理各种数据 相当于人的大脑 内存 存储数据 硬盘 存储数据的 2. 什么是操作系统 控制 ...