其实……这篇是真咕了。

反思:

××我$T1$两个小时构造$xiebi$了(虽然我觉得如果干仨小时可能行?)

……如果$T1$用时过长的话那考试多半不行……

结果:

35
Miemeng 50

03:08:09
0

03:08:09
20

03:08:10
70

03:08:10

T1显然交的暴力……

题解:

T1

好题

构造一下,分分块就可以辣。

#include <iostream>
#include <cstring>
#include <cstdio>
#define N 111111 using namespace std;
int nn,un,dn;
int arr[N];
int epl[N];
void revset(int l,int r){
for(int i=l,j=r;i<=r;i++,j--)
arr[i]=j;
}
int main(){
int T;
cin>>T;
while(T--){
scanf("%d%d%d",&nn,&un,&dn);
if(un*dn>=nn && un+dn<=nn+1){
puts("Yes");
revset(nn-dn+1,nn);
if(un-1!=0){
int pl=(nn-dn)/(un-1),
pn=un-1,
prn=nn-dn-pl*pn;
for(int i=1;i<=pn;i++)
epl[i]=pl;
for(int i=1;i<=prn;i++)
epl[i]++;
// for(int i=1;i<=pn;i++)\
cout<<epl[i]<<" ";\
cout<<endl;
for(int i=1;i<=pn;i++)
epl[i]=epl[i]+epl[i-1];
for(int i=1;i<=pn;i++){
// cout<<epl[i-1]+1<<" "<<epl[i]<<endl;
revset(epl[i-1]+1,epl[i]);
}
}
for(int i=1;i<=nn;i++)
printf("%d ",arr[i]);
puts("");
}
else puts("No");
}
}

T2

性质题,通过找规律证明了有一段不连续的区间并求解。

至于证明请去模大佬的博客(右方翻友链)

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 111111
#define LL long long using namespace std; int nn;
LL arr[N],
pre[N],
ans;
int main(){
scanf("%d",&nn);
for(int i=1;i<=nn;i++)
scanf("%lld",arr+i);
sort(arr+1,arr+nn+1);
for(int i=1;i<=nn;i++)
pre[i]=pre[i-1]+arr[i];
ans=pre[nn]-(arr[1]-1)/2;
for(int i=2;i<=nn;i++){
if((arr[i]-1)/2>pre[i-1])
ans-=(arr[i]-1)/2-pre[i-1];
}
printf("%lld\n",ans);
}

T3

二叉树计数可得$20$

正解$dp$

将树上的位置关系转化成子树的大小关系。

(显然我是水果的……)

#include <iostream>
#include <cstring>
#include <cstdio>
#define LL long long
#define N 888 using namespace std; const int Mod=1e9+7;
LL dp[N][N];
int pn,lin,minn[N],maxn[N]; int main(){
int T,a,b;
cin>>T;
while(T--){
memset(dp,0,sizeof dp);
scanf("%d%d",&pn,&lin);
for(int i=1;i<=pn;i++)
minn[i]=0,maxn[i]=pn;
for(int i=1;i<=lin;i++){
scanf("%d%d",&a,&b);
if(a<b){
// for (int i=1; i<x; ++i) mn[i]=max(mn[i],i-x);
maxn[a]=min(maxn[a],b-a-1);
}//minn[a]=max(minn[a],b-a-1);
else minn[b]=max(minn[b],a-b);
}
for(int i=1;i<=2*pn+1;i++)
dp[i][0]=1;
for(int i=pn;i>=1;i--){
for(int j=1;j<=pn;j++){
for(int k=minn[i];k<=min(maxn[i],j);k++){
if(j-1-k<0)break;
dp[i][j]=(dp[i][j]+dp[i+1][k]*dp[i+1+k][j-1-k]%Mod)%Mod;
}
}
}
printf("%lld\n",dp[1][pn]);
}
}

19-10-16-R的更多相关文章

  1. 2019.10.16&17小结

    话说也蛮久没写小结了,主要这两次考试失分严重,还是总结下吧. 10.16 T1 小奇挖矿2 100/0 [题目背景] 小奇飞船的钻头开启了无限耐久+精准采集模式!这次它要将原矿运到泛光之源的矿石交易市 ...

  2. 程序员的 Ubuntu 19.10 配置与优化指南

    原文地址:程序员的 Ubuntu 19.10 配置与优化指南 0x00 环境 CPU: Intel Core i9-9900k GPU: GeForce RTX 2070 SUPER RAM: DDR ...

  3. 10.16 NOIP模拟赛

    目录 2018.10.16 NOIP模拟赛 A 购物shop B 期望exp(DP 期望 按位计算) C 魔法迷宫maze(状压 暴力) 考试代码 C 2018.10.16 NOIP模拟赛 时间:2h ...

  4. A Newbie’s Install of Keras & Tensorflow on Windows 10 with R

    This weekend, I decided it was time: I was going to update my Python environment and get Keras and T ...

  5. [NOIP2018模拟赛10.16]手残报告

    [NOIP2018模拟赛10.16]手残报告 闲扯 炉石乱斗模式美滋滋啊,又颓到好晚... 上来T2先敲了树剖,看T1发现是个思博DP,然后没过大样例,写个暴力发现还是没过大样例!?才发现理解错题意了 ...

  6. 背水一战 Windows 10 (16) - 动画: ThemeAnimation(主题动画)

    [源码下载] 背水一战 Windows 10 (16) - 动画: ThemeAnimation(主题动画) 作者:webabcd 介绍背水一战 Windows 10 之 动画 PopInThemeA ...

  7. ERROR 2003 (HY000): Can&#39;t connect to MySQL server on &#39;10.16.115.101&#39; (111)

    ubuntu安装之后mysql,使用apt-get安装命令,默认为同意只本地访问 root@idata1:~/software# mysql -uroot -p123456 -h10.16.115.1 ...

  8. ERROR: openstack Error finding address for http://10.16.37.215:9292/v1/images: [Errno 32] Broken pipe

    Try to set: no_proxy=10.16.37.215 this should help 转自: http://askubuntu.com/questions/575938/error-i ...

  9. Ubuntu 19.10 发布 | 云原生生态周报 Vol. 24

    作者 | 木苏.进超.冬岛.元毅.心水.衷源 业界要闻 1.云原生编程语言 Pulumi 1.0 pulumi ,一款中立的开源云开发平台,Pulumi 支持多语言.混合云环境.完全可扩展.初期支持 ...

  10. [Linux] 在 Ubuntu 19.10 上开启 SSH 服务并允许远程登录

    在 Ubuntu 19.10 上安装 SSH,并开启服务 0.检查并确认系统当前是否已安装SSH: sudo ps -e | grep ssh 如果只有 ssh-agent 说明 ssh-server ...

随机推荐

  1. mongodb操作指令(二):索引,聚合,管道

    索引 索引本质上是树,最小的值在最左边的叶子上,最大的值在最右边的叶子上,使用索引可以提高查询速度(而不用全表扫描),也可以预防脏数据的插入(如唯一索引) 索引通常能够极大的提高查询的效率, 如果没有 ...

  2. 总结加密、机密jar中的class

    1.加密和解密部署到jboss中间件中的的单个class文件,原理:使用“java源程序加密解决方案(基于Classloader解密) (2014-07-13 11:31)”blog即可实现: imp ...

  3. 不能scp到本地mac,mac打开ssh服务

    设置->共享->远程登录->所有用户

  4. nodejs与websocket模拟简单的聊天室

    nodejs与websocket模拟简单的聊天室 server.js const http = require('http') const fs = require('fs') var userip ...

  5. 用原生js封装轮播图

    原生js封装轮播图 对于初学js的同学来说,轮播图还是一个难点,尤其是原生js封装轮播图代码,下面是我之前做的一个轮播图项目中封装好的一些代码,有需要的同学可以看一下,有什么不懂的可以看注释,注释看不 ...

  6. 收藏的链接-Qt

    Qt编写的开源帖子集合(懒人专用) - QTCN开发网 - Powered by phpwind http://www.qtcn.org/bbs/read-htm-tid-85501.html?tds ...

  7. CDH断电后 hbase出现spilt块不完整问题

    从错误看起来是regionspilt时候断电了,导致hbase master启动不起来,因为是测试环境只能删除这些region了,掉一部分数据 删除hbase下spilt块,删除zK里面的habse ...

  8. (转)FastCgi与PHP-fpm之间是个什么样的关系

    首先,CGI是干嘛的?CGI是为了保证web server传递过来的数据是标准格式的,方便CGI程序的编写者. web server(比如说nginx)只是内容的分发者.比如,如果请求/index.h ...

  9. SPOJ10707 COT2-Count on a tree II

    COT2 - Count on a tree II 中文题意 离线询问一颗树上路径(u,v)中经过所有点的权值的种类数. 题解 树上莫队.即在树的欧拉序列上进行莫队.同一个点加第一次时增加,第二次时减 ...

  10. Java 生成pdf表格文档

    最近在工作做一个泰国的项目,应供应商要求,需要将每天的交易生成pdf格式的报表上传到供应商的服务器,特此记录实现方法.废话不多说,直接上代码: THSarabunNew.ttf该文件是泰国字体自行网上 ...