BZOJ 1630/2023 Ant Counting 数蚂蚁
DP.
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100050
#define mod 1000000
using namespace std;
int n,m,l,r,sum[][maxn],cnt[maxn],x;
int main()
{
scanf("%d%d%d%d",&n,&m,&l,&r);
for (int i=;i<=m;i++)
{
scanf("%d",&x);
cnt[x]++;
}
for (int i=;i<=m;i++) sum[][i]=;
for (int i=;i<=n;i++)
for (int j=;j<=m;j++)
{
int ret;
if (j>=cnt[i]+) ret=(sum[i&^][j]-sum[i&^][j-cnt[i]-]+mod)%mod;
else ret=sum[i&^][j];
sum[i&][j]=(sum[i&][j-]+ret)%mod;
}
printf("%d\n",(sum[n&][r]-sum[n&][l-]+mod)%mod);
return ;
}
BZOJ 1630/2023 Ant Counting 数蚂蚁的更多相关文章
- 1630/2023: [Usaco2005 Nov]Ant Counting 数蚂蚁
2023: [Usaco2005 Nov]Ant Counting 数蚂蚁 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 85 Solved: 40[S ...
- BZOJ2023: [Usaco2005 Nov]Ant Counting 数蚂蚁
2023: [Usaco2005 Nov]Ant Counting 数蚂蚁 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 56 Solved: 16[S ...
- bzoj2023[Usaco2005 Nov]Ant Counting 数蚂蚁*&&bzoj1630[Usaco2007 Demo]Ant Counting*
bzoj2023[Usaco2005 Nov]Ant Counting 数蚂蚁&&bzoj1630[Usaco2007 Demo]Ant Counting 题意: t个族群,每个族群有 ...
- BZOJ 2023 [Usaco2005 Nov]Ant Counting 数蚂蚁:dp【前缀和优化】
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2023 题意: 有n个家族,共m只蚂蚁(n <= 1000, m <= 1000 ...
- bzoj 2023: [Usaco2005 Nov]Ant Counting 数蚂蚁【生成函数||dp】
用生成函数套路推一推,推完老想NTT--实际上把这个多项式乘法看成dp然后前缀和优化一下即可 #include<iostream> #include<cstdio> using ...
- 【bzoj2023/1630】[Usaco2005 Nov]Ant Counting 数蚂蚁 dp
题解: 水题 f[i][j] 前i种用了j个,前缀和优化就可以了
- [poj3046][Ant counting数蚂蚁]
题目链接 http://noi.openjudge.cn/ch0206/9289/ 描述 Bessie was poking around the ant hill one day watching ...
- bzoj1630 / bzoj2023 [Usaco2005 Nov]Ant Counting 数蚂蚁
Description 有一天,贝茜无聊地坐在蚂蚁洞前看蚂蚁们进进出出地搬运食物.很快贝茜发现有些蚂蚁长得几乎一模一样,于是她认为那些蚂蚁是兄弟,也就是说它们是同一个家族里的成员.她也发现整个 ...
- BZOJ2023: [Usaco2005 Nov]Ant Counting 数蚂蚁(dp)
题意 题目描述的很清楚... 有一天,贝茜无聊地坐在蚂蚁洞前看蚂蚁们进进出出地搬运食物.很快贝茜发现有些蚂蚁长得几乎一模一样,于是她认为那些蚂蚁是兄弟,也就是说它们是同一个家族里的成员.她也发现整个 ...
随机推荐
- js键盘操作事件
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 通过Sql语句导数据
在通过SQL Server向导中的SQL语句导数据时,默认情况下源表中的nvarchar字段类型会变成202,解决此问题的方法是,要重新选择一下对应的数据接收表.
- hdu----(3065)病毒侵袭持续中(AC自动机)
病毒侵袭持续中 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
- mybatis 简单配置
一.com/book/map包下有两个配置文件: 1.MyBatisConfig.xml <?xml version="1.0" encoding="UTF-8&q ...
- Spring Data Jpa配置
Spring Data JPA提供的接口,也是Spring Data JPA的核心概念: 1:Repository:最顶层的接口,是一个空的接口,目的是为了统一所有Repository的类型,且能让组 ...
- BZOJ3307 雨天的尾巴
首先考虑序列怎么做... 只要把操作差分了,记录在每个点上 然后维护一棵权值线段树,表示每个颜色出现的次数,支持单点修改和查询最大值操作 只要把序列扫一遍就好了,时间复杂度$O(n + m*logZ) ...
- IKAnalyzer 和 solr4.3 冲突
solr4.3 运行之后发现异常:Exception in thread "main" java.lang.VerifyError: class org.wltea.analyze ...
- PHP慢脚本日志和Mysql的慢查询日志(转)
1.PHP慢脚本日志 间歇性的502,是后端 PHP-FPM 不可用造成的,间歇性的502一般认为是由于 PHP-FPM 进程重启造成的. 在 PHP-FPM 的子进程数目超过的配置中的数量时候, ...
- 常用三方,Reachability 检测网络连接
常用三方 Reachability 检 测网络连接 用来检查网络连接是否可用:包括WIFI和 WWAN(3G/EDGE/CDMA等)两种工作模式. 可以从Apple网站下载到: http://deve ...
- bzoj 2186: [Sdoi2008]沙拉公主的困惑
#include<cstdio> #include<iostream> #define ll long long #define N 10000009 using namesp ...