其实……这篇是真咕了。

反思:

××我$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. 「题解」:X国的军队

    问题 A: X国的军队 时间限制: 1 Sec  内存限制: 256 MB 题面 题面谢绝公开. 题解 简单贪心. 按照存活的士兵数量(即参加战斗的士兵数量减去阵亡的士兵数量)排序. 若存活士兵数量相 ...

  2. Redis过滤器如何与Envoy代理一起使用

    1.克隆源码到机器 [root@cx-- ~]# git clone https://github.com/envoyproxy/envoy Cloning into 'envoy'... remot ...

  3. js 异步编程思想

    一.js中的异步编程有四种情况 1.定时器 2.所有的事件绑定 3.ajax异步请求 4.回调函数

  4. CSS 属性1

    CSS列表属性 list-style:列表样式,取值:none.去掉项目符号或编号前面的各种符号. CSS边框属性:每个元素都可以加边框线  border-left:左边框线.   格式:border ...

  5. re.groups取出来的空元祖??

    源自学习笔记: day23_1_re_ groups方法取出来的字符是空的元组??为啥? ''' # ------------------------------------------------- ...

  6. 05_mybatis动态sql

    1.sql片段 1.sql片段**** mybatis核心 对sql语句进行灵活操作,通过表达式进行判断,对sql进行灵活拼接.组装. 2.需求 用户信息综合查询列表和用户信息查询列表总数这两个sta ...

  7. USACO 2009 Open Grazing2 /// DP+滚动数组oj26223

    题目大意: 输入n,s:n头牛 s个栅栏 输入n头牛的初始位置 改变他们的位置,满足 1.第一头与最后一头的距离尽量大 2.相邻两头牛之间的距离尽量满足 d=(s-1)/(n-1),偏差不超过1 3. ...

  8. opencv-图像遍历

    #include "stdafx.h" #include<opencv2/opencv.hpp> #include<iostream> #include&l ...

  9. wordpress 插件语法分析器

    在通过查看 apply_filters( 'ap_addon_form_args', array $form_args ) 的html body class中发现wp-parser 字样,就googl ...

  10. WPF 免费控件库(2)

    最近在逛园子的时候发现的园友分享或提及的WPF控件库~ (1) Bootstrap WPF Style,Bootstrap风格的WPF样式 转:http://www.cnblogs.com/tsliw ...